mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CLI: Added ::add
This commit is contained in:
parent
e695b0773b
commit
01bbc3d915
2 changed files with 15 additions and 0 deletions
12
src/CLI.cpp
12
src/CLI.cpp
|
@ -92,6 +92,18 @@ void CLI::entity (const std::string& category, const std::string& name)
|
||||||
_entities.insert (std::pair <std::string, std::string> (category, name));
|
_entities.insert (std::pair <std::string, std::string> (category, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Capture a single argument.
|
||||||
|
void CLI::add (const std::string& argument)
|
||||||
|
{
|
||||||
|
A2 arg (Lexer::trim (argument), Lexer::Type::word);
|
||||||
|
arg.tag ("ORIGINAL");
|
||||||
|
_original_args.push_back (arg);
|
||||||
|
|
||||||
|
// Adding a new argument invalidates prior analysis.
|
||||||
|
_args.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Search for 'value' in _entities category, return canonicalized value.
|
// Search for 'value' in _entities category, return canonicalized value.
|
||||||
bool CLI::canonicalize (
|
bool CLI::canonicalize (
|
||||||
|
|
|
@ -55,10 +55,13 @@ class CLI
|
||||||
public:
|
public:
|
||||||
CLI () = default;
|
CLI () = default;
|
||||||
void entity (const std::string&, const std::string&);
|
void entity (const std::string&, const std::string&);
|
||||||
|
void add (const std::string&);
|
||||||
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::multimap <std::string, std::string> _entities {};
|
std::multimap <std::string, std::string> _entities {};
|
||||||
|
std::vector <A2> _original_args {};
|
||||||
|
std::vector <A2> _args {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue