diff --git a/AUTHORS b/AUTHORS index ecc5beb71..91b49d5e7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -248,3 +248,4 @@ suggestions: Alexandre de Verteuil Scott M Stefan Frühwirth + Pierre Campet diff --git a/ChangeLog b/ChangeLog index 60a06efe1..2e12db91a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,8 @@ Scott Carter). - TW-1590 syntax of rcfile not documented (whitespace, line continuation) (thanks to Scott M). +- TW-1591 add an option to see non-pending project with command task summary + (thanks to Pierre Campet). - Setting 'bulk' to zero is interpreted as infinity, which means there is no amount of changes that is considered dangerous (thanks to Tomas Babej). - Disable hooks in bash completion script. Hooks were previously able to diff --git a/NEWS b/NEWS index f4714695a..41167cb1e 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ New configuration options in taskwarrior 2.4.3 amount of changes that is considered dangerous. - The 'urgency.user.keyword..coefficient' setting allows tasks with specific words in the description to have adjusted urgency. + - The 'summary.all.projects' setting shows all projects in the 'summary' + reportş instead of just those with pending tasks. Newly deprecated features in taskwarrior 2.4.3 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index c72e09e32..e9a4063a9 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -339,11 +339,16 @@ Default value is: 'You have more urgent tasks'. It is a gentle reminder that you are contradicting your own urgency settings. .TP -.B list.all.projects=yes +.B list.all.projects=no May be yes or no, and determines whether the 'projects' command lists all the project names you have used, or just the ones used in active tasks. The default value is "no". +.TP +.B summary.all.projects=no +If set to yes, shows all projects in the summary report, even if there are no +pending tasks. The default value is "no". + .TP .B complete.all.tags=yes May be yes or no, and determines whether the tab completion scripts consider all diff --git a/src/Config.cpp b/src/Config.cpp index 0d762c255..f2b9e94f2 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -338,6 +338,7 @@ std::string Config::_defaults = "_forcecolor=no # Forces color to be on, even for non TTY output\n" "complete.all.tags=no # Include old tag names in '_ags' command\n" "list.all.projects=no # Include old project names in 'projects' command\n" + "summary.all.projects=no # Include old project names in 'summary' command\n" "list.all.tags=no # Include old tag names in 'tags' command\n" "print.empty.columns=no # Print columns which have no data for any task\n" "debug=no # Display diagnostics\n" diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index 4535a8471..5b1d1b00a 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -182,6 +182,7 @@ int CmdShow::execute (std::string& output) " rule.precedence.color" " search.case.sensitive" " shell.prompt" + " summary.all.projects" " tag.indicator" " taskd.server" " taskd.ca" diff --git a/src/commands/CmdSummary.cpp b/src/commands/CmdSummary.cpp index 842948e33..504c24042 100644 --- a/src/commands/CmdSummary.cpp +++ b/src/commands/CmdSummary.cpp @@ -57,6 +57,7 @@ CmdSummary::CmdSummary () int CmdSummary::execute (std::string& output) { int rc = 0; + bool showAllProjects = context.config.getBoolean ("summary.all.projects"); // Apply filter. handleRecurrence (); @@ -68,7 +69,7 @@ int CmdSummary::execute (std::string& output) std::map allProjects; std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) - if (task->getStatus () == Task::pending) + if (showAllProjects || task->getStatus () == Task::pending) allProjects[task->get ("project")] = false; // Initialize counts, sum. @@ -122,7 +123,6 @@ int CmdSummary::execute (std::string& output) } } - // Create a table for output. ViewText view; view.width (context.getWidth ()); @@ -143,7 +143,7 @@ int CmdSummary::execute (std::string& output) std::map ::iterator i; for (i = allProjects.begin (); i != allProjects.end (); ++i) { - if (countPending[i->first] > 0) + if (showAllProjects || countPending[i->first] > 0) { const std::vector parents = extractParents (i->first); std::vector ::const_iterator parent; @@ -169,7 +169,9 @@ int CmdSummary::execute (std::string& output) int c = countCompleted[i->first]; int p = countPending[i->first]; - int completedBar = (c * barWidth) / (c + p); + int completedBar = 0; + if (c + p) + completedBar = (c * barWidth) / (c + p); std::string bar; std::string subbar; @@ -185,8 +187,9 @@ int CmdSummary::execute (std::string& output) } view.set (row, 4, bar); - char percent[12]; - sprintf (percent, "%d%%", 100 * c / (c + p)); + char percent[12] = "0%"; + if (c + p) + sprintf (percent, "%d%%", 100 * c / (c + p)); view.set (row, 3, percent); processed.push_back (i->first); }