mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
- Task now supports a default project and priority for new tasks, via
the new "default.project" and "default.priority" configuration variables (thanks to Vincent Fleuranceau).
This commit is contained in:
parent
4380c7c712
commit
4f8f044644
6 changed files with 32 additions and 1 deletions
|
@ -16,6 +16,9 @@ represents a feature release, and the Z represents a patch.
|
|||
(thanks to Vincent Fleuranceau)
|
||||
+ Task now allows mixed case attribute names (pri:, PRI:, Pri: ...) and
|
||||
commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau)
|
||||
+ Task now supports a default project and priority for new tasks, via
|
||||
the new "default.project" and "default.priority" configuration variables
|
||||
(thanks to Vincent Fleuranceau)
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -248,6 +248,16 @@
|
|||
<dd>
|
||||
Colors any task where the description contains X.
|
||||
</dd>
|
||||
|
||||
<dt>default.project</dt>
|
||||
<dd>
|
||||
Provides a default project name for the "task add ..." command.
|
||||
</dd>
|
||||
|
||||
<dt>default.priority</dt>
|
||||
<dd>
|
||||
Provides a default priority for the "task add ..." command.
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
|
|
@ -100,6 +100,9 @@
|
|||
color is disabled (thanks to Vincent Fleuranceau).
|
||||
<li>Task now allows mixed case attribute names (pri:, PRI:, Pri: ...)
|
||||
and commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau).
|
||||
<li>Task now supports a default project and priority for new tasks, via
|
||||
the new "default.project" and "default.priority" configuration variables
|
||||
(thanks to Vincent Fleuranceau).
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -66,6 +66,20 @@ void handleAdd (const TDB& tdb, T& task, Config& conf)
|
|||
task.setAttribute ("mask", "");
|
||||
}
|
||||
|
||||
/**/
|
||||
// Override with default.project, if not specified.
|
||||
if (task.getAttribute ("project") == "")
|
||||
task.setAttribute ("project", conf.get ("default.project", ""));
|
||||
|
||||
// Override with default.priority, if not specified.
|
||||
if (task.getAttribute ("priority") == "")
|
||||
{
|
||||
std::string defaultPriority = conf.get ("default.priority", "");
|
||||
if (validPriority (defaultPriority))
|
||||
task.setAttribute ("priority", defaultPriority);
|
||||
}
|
||||
/**/
|
||||
|
||||
if (task.getDescription () == "")
|
||||
throw std::string ("Cannot add a blank task.");
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ bool validDate (std::string& date, Config& conf)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static bool validPriority (const std::string& input)
|
||||
bool validPriority (const std::string& input)
|
||||
{
|
||||
if (input != "H" &&
|
||||
input != "M" &&
|
||||
|
|
|
@ -55,6 +55,7 @@ for (typeof (c) *foreach_p = & (c); \
|
|||
|
||||
// parse.cpp
|
||||
void parse (std::vector <std::string>&, std::string&, T&, Config&);
|
||||
bool validPriority (const std::string&);
|
||||
bool validDate (std::string&, Config&);
|
||||
|
||||
// task.cpp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue