CLI: Added ::handleArg0

This commit is contained in:
Paul Beckingham 2016-04-02 16:08:22 -04:00
parent 0ddc2d4d7f
commit 88fe152dbe
2 changed files with 18 additions and 0 deletions

View file

@ -135,12 +135,27 @@ void CLI::add (const std::string& argument)
_args.clear ();
}
////////////////////////////////////////////////////////////////////////////////
// Arg0 is the first argument, which is the name and potentially a relative or
// absolute path to the invoked binary.
void CLI::handleArg0 ()
{
// Capture arg0 separately, because it is the command that was run, and could
// need special handling.
auto raw = _original_args[0].attribute ("raw");
A2 a (raw, Lexer::Type::word);
a.tag ("BINARY");
_args.push_back (a);
}
////////////////////////////////////////////////////////////////////////////////
// Intended to be called after ::add() to perform the final analysis.
void CLI::analyze ()
{
// Process _original_args.
_args.clear ();
handleArg0 ();
}
////////////////////////////////////////////////////////////////////////////////