CLI
- Implemented ::getBinary. - Removed Context::program, and converted DOM and dom.t to call ::getBinary.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user