mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CLI: Added ::handleArg0
This commit is contained in:
parent
0ddc2d4d7f
commit
88fe152dbe
2 changed files with 18 additions and 0 deletions
15
src/CLI.cpp
15
src/CLI.cpp
|
@ -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 ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue