mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
CLI
- Implemented ::getOverride, and updated Context to use it.
This commit is contained in:
parent
03176b45ad
commit
d49222e8c7
3 changed files with 13 additions and 1 deletions
11
src/CLI.cpp
11
src/CLI.cpp
|
@ -354,6 +354,17 @@ void CLI::analyze (bool parse /* = true */)
|
||||||
context.debug ("CLI::analyze end");
|
context.debug ("CLI::analyze end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
const std::string CLI::getOverride ()
|
||||||
|
{
|
||||||
|
std::vector <A>::const_iterator a;
|
||||||
|
for (a = _args.begin (); a != _args.end (); ++a)
|
||||||
|
if (a->hasTag ("RC"))
|
||||||
|
return a->attribute ("file");
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Extract all the FILTER-tagged items.
|
// Extract all the FILTER-tagged items.
|
||||||
const std::string CLI::getFilter ()
|
const std::string CLI::getFilter ()
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
void initialize (int, const char**);
|
void initialize (int, const char**);
|
||||||
void add (const std::string&);
|
void add (const std::string&);
|
||||||
void analyze (bool parse = true);
|
void analyze (bool parse = true);
|
||||||
|
const std::string getOverride ();
|
||||||
const std::string getFilter ();
|
const std::string getFilter ();
|
||||||
const std::vector <std::string> getWords ();
|
const std::vector <std::string> getWords ();
|
||||||
const std::vector <std::string> getModifications ();
|
const std::vector <std::string> getModifications ();
|
||||||
|
|
|
@ -138,8 +138,8 @@ int Context::initialize (int argc, const char** argv)
|
||||||
program = (argc ? argv[0] : "task");
|
program = (argc ? argv[0] : "task");
|
||||||
|
|
||||||
// Scan command line for 'rc:<file>' only.
|
// Scan command line for 'rc:<file>' only.
|
||||||
Parser::getOverrides (argc, argv, rc_file._data);
|
|
||||||
cli.initialize (argc, argv); // task arg0 arg1 ...
|
cli.initialize (argc, argv); // task arg0 arg1 ...
|
||||||
|
rc_file._data = cli.getOverride ();
|
||||||
|
|
||||||
// TASKRC environment variable overrides the command line.
|
// TASKRC environment variable overrides the command line.
|
||||||
char* override = getenv ("TASKRC");
|
char* override = getenv ("TASKRC");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue