- Implemented ::getBinary.
- Removed Context::program, and converted DOM and dom.t to call ::getBinary.
This commit is contained in:
Paul Beckingham 2014-11-02 21:49:42 -05:00
parent 9799fcefed
commit 083b0cb0de
4 changed files with 11 additions and 2 deletions

View file

@ -482,6 +482,15 @@ bool CLI::canonicalize (
return false;
}
////////////////////////////////////////////////////////////////////////////////
std::string CLI::getBinary () const
{
if (_args.size ())
return _args[0].attribute ("raw");
return "";
}
////////////////////////////////////////////////////////////////////////////////
std::string CLI::getCommand () const
{

View file

@ -75,6 +75,7 @@ public:
const std::vector <std::string> getWords ();
const std::vector <std::string> getModifications ();
bool canonicalize (std::string&, const std::string&, const std::string&) const;
std::string getBinary () const;
std::string getCommand () const;
std::string getLimit () const;
const std::string dump (const std::string& title = "CLI Parser") const;

View file

@ -104,7 +104,7 @@ bool DOM::get (const std::string& name, Variant& value)
{
if (name == "context.program")
{
value = Variant (context.program);
value = Variant (context.cli.getBinary ());
return true;
}
else if (name == "context.args")

View file

@ -48,7 +48,6 @@ int main (int argc, char** argv)
// Prime the pump.
const char* fake_argv[] = {"task"};
context.cli.initialize (1, fake_argv);
context.program = "task";
context.config.set ("name", "value");
DOM dom;