mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Enhancements - validation
- Implemented Cmd::isReadOnlyCommand. - Implemented Cmd::isWriteCommand. - Added unit tests for above.
This commit is contained in:
parent
bc8aba26a9
commit
0b14efbb76
7 changed files with 217 additions and 322 deletions
47
src/Cmd.cpp
47
src/Cmd.cpp
|
@ -173,3 +173,50 @@ void Cmd::allCustomReports (std::vector <std::string>& all) const
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Commands that do not directly modify the data files.
|
||||
bool Cmd::isReadOnlyCommand ()
|
||||
{
|
||||
if (command == context.stringtable.get (CMD_ACTIVE, "active") || // R
|
||||
command == context.stringtable.get (CMD_CALENDAR, "calendar") || // R
|
||||
command == context.stringtable.get (CMD_COLORS, "colors") || // R
|
||||
command == context.stringtable.get (CMD_COMPLETED, "completed") || // R
|
||||
command == context.stringtable.get (CMD_EXPORT, "export") || // R
|
||||
command == context.stringtable.get (CMD_HELP, "help") || // R
|
||||
command == context.stringtable.get (CMD_HISTORY, "history") || // R
|
||||
command == context.stringtable.get (CMD_GHISTORY, "ghistory") || // R
|
||||
command == context.stringtable.get (CMD_INFO, "info") || // R
|
||||
command == context.stringtable.get (CMD_NEXT, "next") || // R
|
||||
command == context.stringtable.get (CMD_OVERDUE, "overdue") || // R
|
||||
command == context.stringtable.get (CMD_PROJECTS, "projects") || // R
|
||||
command == context.stringtable.get (CMD_STATS, "stats") || // R
|
||||
command == context.stringtable.get (CMD_SUMMARY, "summary") || // R
|
||||
command == context.stringtable.get (CMD_TAGS, "tags") || // R
|
||||
command == context.stringtable.get (CMD_TIMESHEET, "timesheet") || // R
|
||||
command == context.stringtable.get (CMD_VERSION, "version")) // R
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Commands that directly modify the data files.
|
||||
bool Cmd::isWriteCommand ()
|
||||
{
|
||||
if (command == context.stringtable.get (CMD_ADD, "add") || // W
|
||||
command == context.stringtable.get (CMD_APPEND, "append") || // W
|
||||
command == context.stringtable.get (CMD_ANNOTATE, "annotate") || // W
|
||||
command == context.stringtable.get (CMD_DELETE, "delete") || // W
|
||||
command == context.stringtable.get (CMD_DONE, "done") || // W
|
||||
command == context.stringtable.get (CMD_DUPLICATE, "duplicate") || // W
|
||||
command == context.stringtable.get (CMD_EDIT, "edit") || // W
|
||||
command == context.stringtable.get (CMD_IMPORT, "import") || // W
|
||||
command == context.stringtable.get (CMD_START, "start") || // W
|
||||
command == context.stringtable.get (CMD_STOP, "stop") || // W
|
||||
command == context.stringtable.get (CMD_UNDELETE, "undelete") || // W
|
||||
command == context.stringtable.get (CMD_UNDO, "undo")) // W
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue