Modify Task Property
modify_property.Rd
This is a package internal function used to modify a task given an input and a task to be modified. Because the tasks all are simple textual strings, modification is implemented by text substitution and then re-parsing of the task.
The function presumes that all modifications of properties can be based on strings like "prop:value" (wherein underscores represent a space). Thus, strictly speaking, tags are not properties of a task.
To implement a degree of flexibility in how to specify properties and
values, prop
defaults to NULL so that value
can (also) be used to
specify new values as prop:value
.
Also in view of flexibility, the function presumes that the user ensures to maintain the todo.txt specification. So no checking is done to ascertain whether a property is a valid property of the (original) specification.
Note that setting the property (of which always only one should exist
in any given task) and new value suitable also enables deleting
properties from a task. For instance, modify_property(task, "due:", "")
removes the due date from a task. Does not work yet.
Arguments
- task
A string with one (or, as vector, one or more) task(s) that follow(s) the todo.txt specification by Gina Trapani. When multiple tasks are provided, all tasks are modified in the same way.
- prop
Identifier of the property of the task (a string). Can be postfixed with a colon (e.g. "due:" instead of "due"). Defaults to NULL implying that then
value
needs to be specified asproperty:value
instead of onlyvalue
.- value
New value for the property (a string).