Argument Parsing
- On task modification, all attributes are canonicalized.
This commit is contained in:
@@ -299,7 +299,8 @@ void Command::modify_task (Task& task, Arguments& arguments)
|
||||
std::string name;
|
||||
std::string value;
|
||||
Arguments::extract_attr (arg->_first, name, value);
|
||||
|
||||
if (Arguments::is_attribute (name, name))
|
||||
{
|
||||
// TODO All 'value's must be eval'd first.
|
||||
|
||||
// Dependencies must be resolved to UUIDs.
|
||||
@@ -325,6 +326,9 @@ void Command::modify_task (Task& task, Arguments& arguments)
|
||||
else
|
||||
task.set (name, value);
|
||||
}
|
||||
else
|
||||
throw format (STRING_CMD_ADD_BAD_ATTRIBUTE, name);
|
||||
}
|
||||
|
||||
// Tags need special handling because they are essentially a vector stored
|
||||
// in a single string, therefore Task::{add,remove}Tag must be called as
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
#define STRING_CMD_URGENCY_RESULT "task {1} urgency {2}"
|
||||
#define STRING_CMD_ADD_USAGE "Adds a new task."
|
||||
#define STRING_CMD_ADD_FEEDBACK "Created task {1}."
|
||||
#define STRING_CMD_ADD_BAD_ATTRIBUTE "Unrecognized attribute '{1}'."
|
||||
#define STRING_CMD_MOD_UNEXPECTED "Unexpected argument '{1}' found while modifying a task."
|
||||
#define STRING_CMD_LOG_USAGE "Adds a new task that is already completed."
|
||||
#define STRING_CMD_IDS_USAGE_RANGE "Shows only the IDs of matching tasks, in the form of a range."
|
||||
|
||||
Reference in New Issue
Block a user