mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdDefine: Converted to CLI
This commit is contained in:
parent
6e6cab5f70
commit
5f2774c723
3 changed files with 7 additions and 7 deletions
|
@ -44,20 +44,20 @@
|
|||
// timew define tag <tag> color <color>
|
||||
//
|
||||
int CmdDefine (
|
||||
const std::vector <std::string>& args,
|
||||
CLI& cli,
|
||||
Rules& rules,
|
||||
Database& database,
|
||||
Log& log)
|
||||
{
|
||||
if (args.size () >= 3 &&
|
||||
closeEnough ("define", args[1], 3))
|
||||
auto words = cli.getWords ();
|
||||
if (words.size () >= 1)
|
||||
{
|
||||
std::vector <std::string> subcommands = {"holidays", "week", "day", "tag"};
|
||||
std::vector <std::string> matches;
|
||||
autoComplete (args[2], subcommands, matches);
|
||||
autoComplete (words[0], subcommands, matches);
|
||||
|
||||
if (matches.size () != 1)
|
||||
throw format ("Unrecognized definition '{1}'.", args[2]);
|
||||
throw format ("Unrecognized definition '{1}'.", words[0]);
|
||||
|
||||
if (matches[0] == "holidays")
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ int CmdClear ( );
|
|||
int CmdConfig ( );
|
||||
int CmdContinue ( Rules&, Database&, Log&);
|
||||
int CmdDefault ( Rules&, Database& );
|
||||
int CmdDefine (const std::vector <std::string>&, Rules&, Database&, Log&);
|
||||
int CmdDefine (CLI&, Rules&, Database&, Log&);
|
||||
int CmdDiagnostics ( Rules&, Database&, Extensions&, Log&);
|
||||
int CmdExport (CLI&, Rules&, Database&, Log&);
|
||||
int CmdExtensions ( Rules&, Extensions& );
|
||||
|
|
|
@ -215,7 +215,7 @@ int dispatchCommand (
|
|||
if (command == "clear") status = CmdClear ( );
|
||||
else if (command == "config") status = CmdConfig ( );
|
||||
else if (command == "continue") status = CmdContinue ( rules, database, log);
|
||||
else if (command == "define") status = CmdDefine (args, rules, database, log);
|
||||
else if (command == "define") status = CmdDefine (cli, rules, database, log);
|
||||
else if (command == "diagnostics") status = CmdDiagnostics ( rules, database, extensions, log);
|
||||
else if (command == "export") status = CmdExport (cli, rules, database, log);
|
||||
else if (command == "extensions") status = CmdExtensions ( rules, extensions );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue