- #1501 info report streamlining - partially implemented.
This commit is contained in:
Paul Beckingham 2014-01-26 13:26:07 -05:00
parent b354ed7bd2
commit 38c460d713
3 changed files with 57 additions and 56 deletions

View file

@ -3,6 +3,7 @@
Features Features
+ #1492 task show to display default values when appropriate (thanks to Renato + #1492 task show to display default values when appropriate (thanks to Renato
Alves). Alves).
+ #1501 info report streamlining - partially implemented.
+ Removed deprecated 'echo.command' setting, in favor of the 'header' and + Removed deprecated 'echo.command' setting, in favor of the 'header' and
'affected' verbosity tokens. 'affected' verbosity tokens.
+ Removed deprecated 'edit.verbose' setting, in favor of the 'edit' verbosity + Removed deprecated 'edit.verbose' setting, in favor of the 'edit' verbosity

View file

@ -195,22 +195,6 @@ int CmdInfo::execute (std::string& output)
view.set (row, 1, task->get ("recur")); 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")) if (task->has ("parent"))
{ {
// parent // parent
@ -218,20 +202,36 @@ int CmdInfo::execute (std::string& output)
view.set (row, 0, STRING_COLUMN_LABEL_PARENT); view.set (row, 0, STRING_COLUMN_LABEL_PARENT);
view.set (row, 1, task->get ("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 (); row = view.addRow ();
view.set (row, 0, STRING_COLUMN_LABEL_MASK_IDX); view.set (row, 0, STRING_COLUMN_LABEL_MASK_IDX);
view.set (row, 1, task->get ("imask")); view.set (row, 1, task->get ("imask"));
} }
// due (colored) // entry
if (task->has ("due")) 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 (); Date dt (strtol (created.c_str (), NULL, 10));
view.set (row, 0, STRING_COLUMN_LABEL_DUE); age = OldDuration (now - dt).format ();
view.set (row, 1, Date (task->get_date ("due")).toString (dateformat));
} }
view.set (row, 1, entry + " (" + age + ")");
// wait // wait
if (task->has ("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)); 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 // end
if (task->has ("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)); 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 ... // tags ...
std::vector <std::string> tags; std::vector <std::string> tags;
task->getTags (tags); task->getTags (tags);
@ -283,40 +312,11 @@ int CmdInfo::execute (std::string& output)
std::string uuid = task->get ("uuid"); std::string uuid = task->get ("uuid");
view.set (row, 1, 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 // Task::urgency
row = view.addRow (); row = view.addRow ();
view.set (row, 0, STRING_COLUMN_LABEL_URGENCY); view.set (row, 0, STRING_COLUMN_LABEL_URGENCY);
view.set (row, 1, trimLeft (format (task->urgency (), 4, 4))); 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 // Show any UDAs
std::vector <std::string> all = task->all (); std::vector <std::string> all = task->all ();
std::vector <std::string>::iterator att; std::vector <std::string>::iterator att;

View file

@ -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 # [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}; $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'); 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'); unlike ($output, qr/This task is blocking\n/, 'dependencies - trivial blocked');
# [7,8] t info 2 => blocking 1 # [7,8] t info 2 => blocking 1
$output = qx{../src/task rc:dep.rc info 2 2>&1}; $output = qx{../src/task rc:dep.rc info 2 2>&1};
unlike ($output, qr/This task blocked by/, 'dependencies - trivial blocking'); unlike ($output, qr/This task blocked by/, 'dependencies - trivial blocking');
like ($output, qr/This task is blocking\s+1 One\nUUID/, 'dependencies - trivial blocking'); like ($output, qr/This task is blocking\s+1 One\n/, 'dependencies - trivial blocking');
# [9] t 1 dep:2 (again) # [9] t 1 dep:2 (again)
$output = qx{../src/task rc:dep.rc 1 modify dep:2 2>&1 >/dev/null}; $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 # [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}; $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] # [23,24]
$output = qx{../src/task rc:dep.rc 3,5 do 2>&1; ../src/task rc:dep.rc info 1 2>&1}; $output = qx{../src/task rc:dep.rc 3,5 do 2>&1; ../src/task rc:dep.rc info 1 2>&1};