- Now parses the command line and can distinguish regular commands, as well as
custom reports.
This commit is contained in:
63
src/task.cpp
63
src/task.cpp
@@ -763,42 +763,45 @@ std::string runTaskCommand (
|
||||
std::cout << "[task " << defaultCommand << "]" << std::endl;
|
||||
}
|
||||
|
||||
loadCustomReports (conf);
|
||||
|
||||
std::string command;
|
||||
T task;
|
||||
parse (args, command, task, conf);
|
||||
|
||||
std::string out = "";
|
||||
|
||||
if (command == "" && task.getId ()) { handleModify (tdb, task, conf); }
|
||||
else if (command == "add") { handleAdd (tdb, task, conf); }
|
||||
else if (command == "done") { handleDone (tdb, task, conf); }
|
||||
else if (command == "export") { handleExport (tdb, task, conf); }
|
||||
else if (command == "projects") { out = handleProjects (tdb, task, conf); }
|
||||
else if (command == "tags") { out = handleTags (tdb, task, conf); }
|
||||
else if (command == "info") { out = handleInfo (tdb, task, conf); }
|
||||
else if (command == "undelete") { out = handleUndelete (tdb, task, conf); }
|
||||
else if (command == "delete") { out = handleDelete (tdb, task, conf); }
|
||||
else if (command == "start") { out = handleStart (tdb, task, conf); }
|
||||
else if (command == "stop") { out = handleStop (tdb, task, conf); }
|
||||
else if (command == "undo") { out = handleUndo (tdb, task, conf); }
|
||||
else if (command == "stats") { out = handleReportStats (tdb, task, conf); }
|
||||
else if (command == "list") { if (gc) tdb.gc (); out = handleList (tdb, task, conf); }
|
||||
else if (command == "long") { if (gc) tdb.gc (); out = handleLongList (tdb, task, conf); }
|
||||
else if (command == "ls") { if (gc) tdb.gc (); out = handleSmallList (tdb, task, conf); }
|
||||
else if (command == "completed") { if (gc) tdb.gc (); out = handleCompleted (tdb, task, conf); }
|
||||
else if (command == "summary") { if (gc) tdb.gc (); out = handleReportSummary (tdb, task, conf); }
|
||||
else if (command == "next") { if (gc) tdb.gc (); out = handleReportNext (tdb, task, conf); }
|
||||
else if (command == "history") { if (gc) tdb.gc (); out = handleReportHistory (tdb, task, conf); }
|
||||
else if (command == "ghistory") { if (gc) tdb.gc (); out = handleReportGHistory (tdb, task, conf); }
|
||||
else if (command == "calendar") { if (gc) tdb.gc (); out = handleReportCalendar (tdb, task, conf); }
|
||||
else if (command == "active") { if (gc) tdb.gc (); out = handleReportActive (tdb, task, conf); }
|
||||
else if (command == "overdue") { if (gc) tdb.gc (); out = handleReportOverdue (tdb, task, conf); }
|
||||
else if (command == "oldest") { if (gc) tdb.gc (); out = handleReportOldest (tdb, task, conf); }
|
||||
else if (command == "newest") { if (gc) tdb.gc (); out = handleReportNewest (tdb, task, conf); }
|
||||
else if (command == "colors") { out = handleColor ( conf); }
|
||||
else if (command == "version") { out = handleVersion ( conf); }
|
||||
else if (command == "help") { longUsage ( conf); }
|
||||
else { shortUsage ( conf); }
|
||||
if (command == "" && task.getId ()) { handleModify (tdb, task, conf ); }
|
||||
else if (command == "add") { handleAdd (tdb, task, conf ); }
|
||||
else if (command == "done") { handleDone (tdb, task, conf ); }
|
||||
else if (command == "export") { handleExport (tdb, task, conf ); }
|
||||
else if (command == "projects") { out = handleProjects (tdb, task, conf ); }
|
||||
else if (command == "tags") { out = handleTags (tdb, task, conf ); }
|
||||
else if (command == "info") { out = handleInfo (tdb, task, conf ); }
|
||||
else if (command == "undelete") { out = handleUndelete (tdb, task, conf ); }
|
||||
else if (command == "delete") { out = handleDelete (tdb, task, conf ); }
|
||||
else if (command == "start") { out = handleStart (tdb, task, conf ); }
|
||||
else if (command == "stop") { out = handleStop (tdb, task, conf ); }
|
||||
else if (command == "undo") { out = handleUndo (tdb, task, conf ); }
|
||||
else if (command == "stats") { out = handleReportStats (tdb, task, conf ); }
|
||||
else if (command == "list") { if (gc) tdb.gc (); out = handleList (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "long") { if (gc) tdb.gc (); out = handleLongList (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "ls") { if (gc) tdb.gc (); out = handleSmallList (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "completed") { if (gc) tdb.gc (); out = handleCompleted (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "summary") { if (gc) tdb.gc (); out = handleReportSummary (tdb, task, conf ); }
|
||||
else if (command == "next") { if (gc) tdb.gc (); out = handleReportNext (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "history") { if (gc) tdb.gc (); out = handleReportHistory (tdb, task, conf ); }
|
||||
else if (command == "ghistory") { if (gc) tdb.gc (); out = handleReportGHistory (tdb, task, conf ); }
|
||||
else if (command == "calendar") { if (gc) tdb.gc (); out = handleReportCalendar (tdb, task, conf ); }
|
||||
else if (command == "active") { if (gc) tdb.gc (); out = handleReportActive (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "overdue") { if (gc) tdb.gc (); out = handleReportOverdue (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "oldest") { if (gc) tdb.gc (); out = handleReportOldest (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "newest") { if (gc) tdb.gc (); out = handleReportNewest (tdb, task, conf ); } // TODO replace with Custom
|
||||
else if (command == "colors") { out = handleColor ( conf ); }
|
||||
else if (command == "version") { out = handleVersion ( conf ); }
|
||||
else if (command == "help") { longUsage ( conf ); }
|
||||
else if (isCustomReport (command)) { if (gc) tdb.gc (); out = handleCustomReport (tdb, task, conf, command); } // New Custom reports
|
||||
else { shortUsage ( conf ); }
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user