Feature #1033
- Feature #1033 allows UDAs to contribute to urgency (thanks to Max Muller).
This commit is contained in:
@@ -37,6 +37,7 @@ Features
|
||||
creation of the default rc file and data directory, which allows for
|
||||
programmatic initialization without keystroke synthesis (thanks to Nicholas
|
||||
Rabenau).
|
||||
+ Feature #1033 allows UDAs to contribute to urgency (thanks to Max Muller).
|
||||
+ Color error messages with a specific configuration variable 'color.error'.
|
||||
|
||||
Bugs
|
||||
|
||||
1
NEWS
1
NEWS
@@ -24,6 +24,7 @@ New commands in taskwarrior 2.1.0
|
||||
New configuration options in taskwarrior 2.1.0
|
||||
|
||||
- urgency.scheduled.coefficient
|
||||
- urgency.uda.<name>.coefficient
|
||||
- color.scheduled
|
||||
- color.blocking
|
||||
|
||||
|
||||
@@ -1017,6 +1017,9 @@ Specific tag coefficient.
|
||||
.B urgency.user.project.<project>.coefficient=...
|
||||
.RS
|
||||
Specific project coefficient.
|
||||
.B urgency.uda.<name>.coefficient=...
|
||||
.RS
|
||||
Presence/absence of UDA data.
|
||||
.RE
|
||||
|
||||
The coefficients reflect the relative importance of the various terms in the
|
||||
|
||||
@@ -153,6 +153,7 @@ std::string Config::_defaults =
|
||||
"\n"
|
||||
"#urgency.user.project.foo.coefficient=5.0 # Urgency coefficients for 'foo' project\n"
|
||||
"#urgency.user.tag.foo.coefficient=5.0 # Urgency coefficients for 'foo' tag\n"
|
||||
"#urgency.uda.foo.coefficient=5.0 # Urgency coefficients for UDA 'foo'\n"
|
||||
"\n"
|
||||
"# Color controls.\n"
|
||||
"color=on # Enable color\n"
|
||||
|
||||
13
src/Task.cpp
13
src/Task.cpp
@@ -92,8 +92,11 @@ void initializeUrgencyCoefficients ()
|
||||
|
||||
std::vector <std::string>::iterator var;
|
||||
for (var = all.begin (); var != all.end (); ++var)
|
||||
if (var->substr (0, 13) == "urgency.user.")
|
||||
{
|
||||
if (var->substr (0, 13) == "urgency.user." ||
|
||||
var->substr (0, 12) == "urgency.uda.")
|
||||
coefficients[*var] = context.config.getReal (*var);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1365,6 +1368,14 @@ float Task::urgency_c () const
|
||||
value += var->second;
|
||||
}
|
||||
}
|
||||
else if (var->first.substr (0, 12) == "urgency.uda.")
|
||||
{
|
||||
// urgency.uda.<name>.coefficient
|
||||
std::string::size_type end = var->first.find (".coefficient");
|
||||
if (end != std::string::npos)
|
||||
if (has (var->first.substr (12, end - 12)))
|
||||
value += var->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,8 @@ int CmdShow::execute (std::string& output)
|
||||
i->substr (0, 6) != "merge." &&
|
||||
i->substr (0, 4) != "uda." &&
|
||||
i->substr (0, 21) != "urgency.user.project." &&
|
||||
i->substr (0, 17) != "urgency.user.tag.")
|
||||
i->substr (0, 17) != "urgency.user.tag." &&
|
||||
i->substr (0, 12) != "urgency.uda.")
|
||||
{
|
||||
unrecognized.push_back (*i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user