- Allows colons in the description, provided they are not preceded by a valid attribute name.
This commit is contained in:
@@ -23,6 +23,8 @@ represents a feature release, and the Z represents a patch.
|
|||||||
+ Automatically shuts off color, curses when output is not a tty
|
+ Automatically shuts off color, curses when output is not a tty
|
||||||
+ Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...)
|
+ Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...)
|
||||||
+ Supports the ~ character in .taskrc data.location
|
+ Supports the ~ character in .taskrc data.location
|
||||||
|
+ Allows colons on the description, provided what is to the left of the colon
|
||||||
|
is not a standard attribute name
|
||||||
+ Bug: Fixed where Esc[0m sequences were being emitted for no good reason
|
+ Bug: Fixed where Esc[0m sequences were being emitted for no good reason
|
||||||
+ Bug: Fixed underlined table headers when color is turned off
|
+ Bug: Fixed underlined table headers when color is turned off
|
||||||
+ Bug: Adding a blank priority resulted in an assigned garbage value
|
+ Bug: Adding a blank priority resulted in an assigned garbage value
|
||||||
|
|||||||
@@ -60,6 +60,8 @@
|
|||||||
<li>Added support for task filtering on all reports
|
<li>Added support for task filtering on all reports
|
||||||
<li>Automatically shuts off color, ncurses when output is not to a tty
|
<li>Automatically shuts off color, ncurses when output is not to a tty
|
||||||
<li>Added support for the ~ character in .taskrc data.location, for flexibility
|
<li>Added support for the ~ character in .taskrc data.location, for flexibility
|
||||||
|
<li>Allows colons on the description, provided what is to the left of the colon
|
||||||
|
is not a standard attribute name
|
||||||
<li>Fixed bug where Esc[0m sequences were being emitted for no good reason
|
<li>Fixed bug where Esc[0m sequences were being emitted for no good reason
|
||||||
<li>Fixed bug where table headers are underlined when color is turned off
|
<li>Fixed bug where table headers are underlined when color is turned off
|
||||||
<li>Fixed bug where adding a blank priority resulted in an assigned garbage value
|
<li>Fixed bug where adding a blank priority resulted in an assigned garbage value
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ static const char* attributes[] =
|
|||||||
"recur",
|
"recur",
|
||||||
"until",
|
"until",
|
||||||
"mask",
|
"mask",
|
||||||
|
"imask",
|
||||||
"",
|
"",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -157,7 +158,8 @@ void guess (const std::string& type, const char** list, std::string& candidate)
|
|||||||
candidate = matches[0];
|
candidate = matches[0];
|
||||||
|
|
||||||
else if (0 == matches.size ())
|
else if (0 == matches.size ())
|
||||||
throw std::string ("Unrecognized ") + type + " '" + candidate + "'";
|
// throw std::string ("Unrecognized ") + type + " '" + candidate + "'";
|
||||||
|
candidate = "";
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -225,32 +227,37 @@ static bool validAttribute (
|
|||||||
Config& conf)
|
Config& conf)
|
||||||
{
|
{
|
||||||
guess ("attribute", attributes, name);
|
guess ("attribute", attributes, name);
|
||||||
|
if (name != "")
|
||||||
if ((name == "fg" || name == "bg") && value != "")
|
|
||||||
guess ("color", colors, value);
|
|
||||||
|
|
||||||
else if (name == "due" && value != "")
|
|
||||||
validDate (value, conf);
|
|
||||||
|
|
||||||
else if (name == "until" && value != "")
|
|
||||||
validDate (value, conf);
|
|
||||||
|
|
||||||
else if (name == "priority")
|
|
||||||
{
|
{
|
||||||
value = upperCase (value);
|
if ((name == "fg" || name == "bg") && value != "")
|
||||||
return validPriority (value);
|
guess ("color", colors, value);
|
||||||
|
|
||||||
|
else if (name == "due" && value != "")
|
||||||
|
validDate (value, conf);
|
||||||
|
|
||||||
|
else if (name == "until" && value != "")
|
||||||
|
validDate (value, conf);
|
||||||
|
|
||||||
|
else if (name == "priority")
|
||||||
|
{
|
||||||
|
value = upperCase (value);
|
||||||
|
return validPriority (value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some attributes are intended to be private.
|
||||||
|
else if (name == "entry" ||
|
||||||
|
name == "start" ||
|
||||||
|
name == "end" ||
|
||||||
|
name == "mask" ||
|
||||||
|
name == "imask")
|
||||||
|
throw std::string ("\"") +
|
||||||
|
name +
|
||||||
|
"\" is not an attribute you may modify directly.";
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some attributes are intended to be private.
|
return false;
|
||||||
else if (name == "entry" ||
|
|
||||||
name == "start" ||
|
|
||||||
name == "end" ||
|
|
||||||
name == "mask")
|
|
||||||
throw std::string ("\"") +
|
|
||||||
name +
|
|
||||||
"\" is not an attribute you may modify directly.";
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -285,7 +292,12 @@ static bool validDescription (const std::string& input)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
static bool validCommand (std::string& input)
|
static bool validCommand (std::string& input)
|
||||||
{
|
{
|
||||||
guess ("command", commands, input);
|
std::string copy = input;
|
||||||
|
guess ("command", commands, copy);
|
||||||
|
if (copy == "")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
input = copy;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,8 +392,15 @@ void parse (
|
|||||||
std::string value = arg.substr (colon + 1, std::string::npos);
|
std::string value = arg.substr (colon + 1, std::string::npos);
|
||||||
|
|
||||||
if (validAttribute (name, value, conf))
|
if (validAttribute (name, value, conf))
|
||||||
|
{
|
||||||
if (name != "recur" || validDuration (value))
|
if (name != "recur" || validDuration (value))
|
||||||
task.setAttribute (name, value);
|
task.setAttribute (name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it is not a valid attribute, then allow the argument as part of
|
||||||
|
// the description.
|
||||||
|
else
|
||||||
|
descCandidate += arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Substitution of description text.
|
// Substitution of description text.
|
||||||
@@ -393,10 +412,10 @@ void parse (
|
|||||||
// Command.
|
// Command.
|
||||||
else if (command == "")
|
else if (command == "")
|
||||||
{
|
{
|
||||||
if (!isCommand (arg))
|
if (isCommand (arg) && validCommand (arg))
|
||||||
descCandidate += std::string (arg) + " ";
|
|
||||||
else if (validCommand (arg))
|
|
||||||
command = arg;
|
command = arg;
|
||||||
|
else
|
||||||
|
throw std::string ("'") + arg + "' is not a valid command.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anything else is just considered description.
|
// Anything else is just considered description.
|
||||||
|
|||||||
Reference in New Issue
Block a user