mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Feature #1501
- #1501 info report streamlining - partially implemented.
This commit is contained in:
parent
b354ed7bd2
commit
38c460d713
3 changed files with 57 additions and 56 deletions
|
@ -3,6 +3,7 @@
|
|||
Features
|
||||
+ #1492 task show to display default values when appropriate (thanks to Renato
|
||||
Alves).
|
||||
+ #1501 info report streamlining - partially implemented.
|
||||
+ 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
|
||||
|
|
|
@ -195,22 +195,6 @@ int CmdInfo::execute (std::string& output)
|
|||
view.set (row, 1, task->get ("recur"));
|
||||
}
|
||||
|
||||
// until
|
||||
if (task->has ("until"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_CMD_INFO_UNTIL);
|
||||
view.set (row, 1, Date (task->get_date ("until")).toString (dateformat));
|
||||
}
|
||||
|
||||
// mask
|
||||
if (task->getStatus () == Task::recurring)
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_MASK);
|
||||
view.set (row, 1, task->get ("mask"));
|
||||
}
|
||||
|
||||
if (task->has ("parent"))
|
||||
{
|
||||
// parent
|
||||
|
@ -218,20 +202,36 @@ int CmdInfo::execute (std::string& output)
|
|||
view.set (row, 0, STRING_COLUMN_LABEL_PARENT);
|
||||
view.set (row, 1, task->get ("parent"));
|
||||
|
||||
// imask
|
||||
// mask
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_MASK);
|
||||
view.set (row, 1, task->get ("mask"));
|
||||
}
|
||||
|
||||
// imask
|
||||
if (task->has ("imask"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_MASK_IDX);
|
||||
view.set (row, 1, task->get ("imask"));
|
||||
}
|
||||
|
||||
// due (colored)
|
||||
if (task->has ("due"))
|
||||
// entry
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_ENTERED);
|
||||
Date dt (task->get_date ("entry"));
|
||||
std::string entry = dt.toString (dateformat);
|
||||
|
||||
std::string age;
|
||||
std::string created = task->get ("entry");
|
||||
if (created.length ())
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_DUE);
|
||||
view.set (row, 1, Date (task->get_date ("due")).toString (dateformat));
|
||||
Date dt (strtol (created.c_str (), NULL, 10));
|
||||
age = OldDuration (now - dt).format ();
|
||||
}
|
||||
|
||||
view.set (row, 1, entry + " (" + age + ")");
|
||||
|
||||
// wait
|
||||
if (task->has ("wait"))
|
||||
{
|
||||
|
@ -256,6 +256,14 @@ int CmdInfo::execute (std::string& output)
|
|||
view.set (row, 1, Date (task->get_date ("start")).toString (dateformat));
|
||||
}
|
||||
|
||||
// due (colored)
|
||||
if (task->has ("due"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_DUE);
|
||||
view.set (row, 1, Date (task->get_date ("due")).toString (dateformat));
|
||||
}
|
||||
|
||||
// end
|
||||
if (task->has ("end"))
|
||||
{
|
||||
|
@ -264,6 +272,27 @@ int CmdInfo::execute (std::string& output)
|
|||
view.set (row, 1, Date (task->get_date ("end")).toString (dateformat));
|
||||
}
|
||||
|
||||
// until
|
||||
if (task->has ("until"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_CMD_INFO_UNTIL);
|
||||
view.set (row, 1, Date (task->get_date ("until")).toString (dateformat));
|
||||
}
|
||||
|
||||
// modified
|
||||
if (task->has ("modified"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
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 + ")");
|
||||
}
|
||||
|
||||
// tags ...
|
||||
std::vector <std::string> tags;
|
||||
task->getTags (tags);
|
||||
|
@ -283,40 +312,11 @@ int CmdInfo::execute (std::string& output)
|
|||
std::string uuid = task->get ("uuid");
|
||||
view.set (row, 1, uuid);
|
||||
|
||||
// entry
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_ENTERED);
|
||||
Date dt (task->get_date ("entry"));
|
||||
std::string entry = dt.toString (dateformat);
|
||||
|
||||
std::string age;
|
||||
std::string created = task->get ("entry");
|
||||
if (created.length ())
|
||||
{
|
||||
Date dt (strtol (created.c_str (), NULL, 10));
|
||||
age = OldDuration (now - dt).format ();
|
||||
}
|
||||
|
||||
view.set (row, 1, entry + " (" + age + ")");
|
||||
|
||||
// Task::urgency
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_URGENCY);
|
||||
view.set (row, 1, trimLeft (format (task->urgency (), 4, 4)));
|
||||
|
||||
// modified
|
||||
if (task->has ("modified"))
|
||||
{
|
||||
row = view.addRow ();
|
||||
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 + ")");
|
||||
}
|
||||
|
||||
// Show any UDAs
|
||||
std::vector <std::string> all = task->all ();
|
||||
std::vector <std::string>::iterator att;
|
||||
|
|
|
@ -66,13 +66,13 @@ like ($output, qr/No tasks specified\./, 'dependencies - add dependency to nonex
|
|||
|
||||
# [5,6] t 1 dep:2; t info 1 => blocked by 2
|
||||
$output = qx{../src/task rc:dep.rc 1 modify dep:2 2>&1; ../src/task rc:dep.rc info 1 2>&1};
|
||||
like ($output, qr/This task blocked by\s+2 Two\nUUID/, 'dependencies - trivial blocked');
|
||||
unlike ($output, qr/This task is blocking\n/, 'dependencies - trivial blocked');
|
||||
like ($output, qr/This task blocked by\s+2 Two\n/, 'dependencies - trivial blocked');
|
||||
unlike ($output, qr/This task is blocking\n/, 'dependencies - trivial blocked');
|
||||
|
||||
# [7,8] t info 2 => blocking 1
|
||||
$output = qx{../src/task rc:dep.rc info 2 2>&1};
|
||||
unlike ($output, qr/This task blocked by/, 'dependencies - trivial blocking');
|
||||
like ($output, qr/This task is blocking\s+1 One\nUUID/, 'dependencies - trivial blocking');
|
||||
unlike ($output, qr/This task blocked by/, 'dependencies - trivial blocking');
|
||||
like ($output, qr/This task is blocking\s+1 One\n/, 'dependencies - trivial blocking');
|
||||
|
||||
# [9] t 1 dep:2 (again)
|
||||
$output = qx{../src/task rc:dep.rc 1 modify dep:2 2>&1 >/dev/null};
|
||||
|
@ -135,7 +135,7 @@ like ($output, qr/Modified \d+ task/, 'dependencies - task depending on recurrin
|
|||
|
||||
# [22] t 1 dep:2,3,4; t 1 dep:-2,-4,5; t info 1 => blocked by 3,5
|
||||
$output = qx{../src/task rc:dep.rc 1 modify dep:2,3,4 2>&1; ../src/task rc:dep.rc 1 modify dep:-2,-4,5 2>&1; ../src/task rc:dep.rc info 1 2>&1};
|
||||
like ($output, qr/This task blocked by\s+3 Three\n\s+5 Five\nUUID/, 'dependencies - multiple dependencies modified');
|
||||
like ($output, qr/This task blocked by\s+3 Three\n\s+5 Five\n/, 'dependencies - multiple dependencies modified');
|
||||
|
||||
# [23,24]
|
||||
$output = qx{../src/task rc:dep.rc 3,5 do 2>&1; ../src/task rc:dep.rc info 1 2>&1};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue