mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug TW-1274
- TW-1274 Map 'modification' attribute to 'modified' (thanks to jck).
This commit is contained in:
parent
14b1ba4151
commit
61a9703ab4
4 changed files with 36 additions and 11 deletions
2
AUTHORS
2
AUTHORS
|
@ -199,4 +199,4 @@ suggestions:
|
|||
Kosta H
|
||||
Hector Arciga
|
||||
Jan Kunder
|
||||
|
||||
jck
|
||||
|
|
|
@ -15,6 +15,7 @@ Features
|
|||
+ TW-1260 New virtual tags YESTERDAY, TOMORROW.
|
||||
+ TW-1261 Migrate test bug.360.t to new unit testing framework (thanks to
|
||||
Renato Alves).
|
||||
+ TW-1274 Map 'modification' attribute to 'modified' (thanks to jck).
|
||||
+ Removed deprecated 'echo.command' setting, in favor of the 'header' and
|
||||
'affected' verbosity tokens.
|
||||
+ Removed deprecated 'edit.verbose' setting, in favor of the 'edit' verbosity
|
||||
|
|
30
src/Task.cpp
30
src/Task.cpp
|
@ -539,6 +539,10 @@ void Task::parse (const std::string& input)
|
|||
value[value.length () - 1] == 'm')
|
||||
value += 'o';
|
||||
|
||||
// TW-1274, Standardization.
|
||||
if (name == "modification")
|
||||
name = "modified";
|
||||
|
||||
if (name.substr (0, 11) == "annotation_")
|
||||
++annotation_count;
|
||||
|
||||
|
@ -596,6 +600,13 @@ void Task::parseJSON (const std::string& line)
|
|||
else if (i->first == "urgency")
|
||||
;
|
||||
|
||||
// TW-1274 Standardization.
|
||||
else if (i->first == "modification")
|
||||
{
|
||||
Date d (unquoteText (i->second->dump ()));
|
||||
set ("modified", d.toEpochString ());
|
||||
}
|
||||
|
||||
// Dates are converted from ISO to epoch.
|
||||
else if (type == "date")
|
||||
{
|
||||
|
@ -604,7 +615,7 @@ void Task::parseJSON (const std::string& line)
|
|||
}
|
||||
|
||||
// Tags are an array of JSON strings.
|
||||
else if (i->first == "tags")
|
||||
else if (i->first == "tags" && i->second->type() == json::j_array)
|
||||
{
|
||||
json::array* tags = (json::array*)i->second;
|
||||
json_array_iter t;
|
||||
|
@ -616,6 +627,13 @@ void Task::parseJSON (const std::string& line)
|
|||
addTag (tag->_data);
|
||||
}
|
||||
}
|
||||
// This is a temporary measure to allow Mirakel sync, and will be removed
|
||||
// in a future release.
|
||||
else if (i->first == "tags" && i->second->type() == json::j_string)
|
||||
{
|
||||
json::string* tag = (json::string*)i->second;
|
||||
addTag (tag->_data);
|
||||
}
|
||||
|
||||
// Strings are decoded.
|
||||
else if (type == "string")
|
||||
|
@ -818,7 +836,10 @@ std::string Task::composeF4 () const
|
|||
{
|
||||
ff4 += (first ? "" : " ")
|
||||
+ it->first
|
||||
+ ":\"" + encode (json::encode (it->second)) + "\"";
|
||||
+ ":\""
|
||||
+ encode (json::encode (it->second))
|
||||
+ "\"";
|
||||
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
@ -858,6 +879,11 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
|
|||
if (type == "date")
|
||||
{
|
||||
Date d (i->second);
|
||||
if (i->first == "modification")
|
||||
out << "\"modified\":\""
|
||||
<< d.toISO ()
|
||||
<< "\"";
|
||||
else
|
||||
out << "\""
|
||||
<< i->first
|
||||
<< "\":\""
|
||||
|
|
|
@ -289,10 +289,8 @@ int CmdInfo::execute (std::string& output)
|
|||
view.set (row, 0, STRING_CMD_INFO_MODIFIED);
|
||||
|
||||
Date mod (task->get_date ("modified"));
|
||||
|
||||
std::string age = OldDuration (now - mod).format ();
|
||||
view.set (row, 1, Date (task->get_date ("modified")).toString (dateformat) +
|
||||
" (" + age + ")");
|
||||
view.set (row, 1, mod.toString (dateformat) + " (" + age + ")");
|
||||
}
|
||||
|
||||
// tags ...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue