mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI
- Implemented ::getBinary. - Removed Context::program, and converted DOM and dom.t to call ::getBinary.
This commit is contained in:
parent
9799fcefed
commit
083b0cb0de
4 changed files with 11 additions and 2 deletions
|
@ -482,6 +482,15 @@ bool CLI::canonicalize (
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
std::string CLI::getBinary () const
|
||||||
|
{
|
||||||
|
if (_args.size ())
|
||||||
|
return _args[0].attribute ("raw");
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string CLI::getCommand () const
|
std::string CLI::getCommand () const
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,6 +75,7 @@ public:
|
||||||
const std::vector <std::string> getWords ();
|
const std::vector <std::string> getWords ();
|
||||||
const std::vector <std::string> getModifications ();
|
const std::vector <std::string> getModifications ();
|
||||||
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
||||||
|
std::string getBinary () const;
|
||||||
std::string getCommand () const;
|
std::string getCommand () const;
|
||||||
std::string getLimit () const;
|
std::string getLimit () const;
|
||||||
const std::string dump (const std::string& title = "CLI Parser") const;
|
const std::string dump (const std::string& title = "CLI Parser") const;
|
||||||
|
|
|
@ -104,7 +104,7 @@ bool DOM::get (const std::string& name, Variant& value)
|
||||||
{
|
{
|
||||||
if (name == "context.program")
|
if (name == "context.program")
|
||||||
{
|
{
|
||||||
value = Variant (context.program);
|
value = Variant (context.cli.getBinary ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (name == "context.args")
|
else if (name == "context.args")
|
||||||
|
|
|
@ -48,7 +48,6 @@ int main (int argc, char** argv)
|
||||||
// Prime the pump.
|
// Prime the pump.
|
||||||
const char* fake_argv[] = {"task"};
|
const char* fake_argv[] = {"task"};
|
||||||
context.cli.initialize (1, fake_argv);
|
context.cli.initialize (1, fake_argv);
|
||||||
context.program = "task";
|
|
||||||
context.config.set ("name", "value");
|
context.config.set ("name", "value");
|
||||||
|
|
||||||
DOM dom;
|
DOM dom;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue