diff --git a/ChangeLog b/ChangeLog index 0b8355e77..b3c953026 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ command. + Added feature #390, an extra dateformat for annotations (thanks to Cory Donnelly). + + Added feature #407, a new 'task show' command to display the current + configuration settings or just the ones matching a search string. + 'task config' is now only used to set new configuration values. + Fixed bug #406 so that task now includes command aliases in the _commands helper command used by shell completion scripts. + Fixed bug #211 - it was unclear which commands modify a task description. diff --git a/NEWS b/NEWS index d03df28b6..20840a6c5 100644 --- a/NEWS +++ b/NEWS @@ -1,25 +1,11 @@ New Features in task 1.9 - - 256-color support - - Support for coloring alternate lines of output. Remember that old green - and white fan-fold printer paper? - - Supports nested .taskrc files with the new "include" statement" - - New columns that include the time as well as date - - New attribute modifiers - - New date format for reports - - Improved .taskrc validation - - Improved calendar report with custom coloring and optional task details output - - Holidays are now supported in the calendar report - - Ability to use multiple, similar filter terms, like: - task list project.not:foo project.not:bar - - Ability to do case-sensitive or case-insensitive search for keywords, and - substitutions in the description and annotations. - New 'log' command to add tasks that are already completed. - New annual history and ghistory command variations. - Alias support in shell completion scripts. - New iCalendar export format. - - Task is now part of Debian + - New 'show' command to display configuration settings. Please refer to the ChangeLog file for full details. There are too many to list here. diff --git a/doc/man/task.1 b/doc/man/task.1 index 08e588229..46a1697fc 100644 --- a/doc/man/task.1 +++ b/doc/man/task.1 @@ -130,10 +130,9 @@ Shows the task version number Shows the long usage text. .TP -.B show -Shows the current settings in the task configuration file. If a section-name is -specified just the settings for the particular section will be displayed. -Section-names are: alias, calendar, color, general, holiday, report. +.B show [all | substring]" +Shows all the current settings in the task configuration file. If a substring +is specified just the settings containing that substring will be displayed. .TP .B config [name [value | '']] diff --git a/src/command.cpp b/src/command.cpp index 26288e32e..e4a0f14f2 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -614,6 +614,9 @@ int handleShow (std::string &outs) std::vector args; split (args, context.task.get ("description"), ' '); + if (args.size () > 1) + throw std::string ("The show command takes zero or one option."); + int width = context.getWidth (); std::vector all; @@ -696,21 +699,29 @@ int handleShow (std::string &outs) table.sortOn (0, Table::ascendingCharacter); Color error ("bold white on red"); + + std::string section; + + if (args.size () == 1) + section = args[0]; + + if (section == "all") + section = ""; + foreach (i, all) { - std::string value = context.config.get (*i); + std::string::size_type loc = i->find (section, 0); - // TODO Add configuration variables and names to output table - // TODO depending on argument to the show command - // TODO alias, calendar, color, general, holiday, report + if (loc != std::string::npos) + { + int row = table.addRow (); + table.addCell (row, 0, *i); + table.addCell (row, 1, context.config.get (*i)); - int row = table.addRow (); - table.addCell (row, 0, *i); - table.addCell (row, 1, value); - - if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor")) - if (std::find (unrecognized.begin (), unrecognized.end (), *i) != unrecognized.end ()) - table.setRowColor (row, error); + if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor")) + if (std::find (unrecognized.begin (), unrecognized.end (), *i) != unrecognized.end ()) + table.setRowColor (row, error); + } } Color bold ("bold"); diff --git a/src/report.cpp b/src/report.cpp index 117ae3d8d..791c64951 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -207,8 +207,8 @@ int shortUsage (std::string &outs) table.addCell (row, 2, "Shows the task version number."); row = table.addRow (); - table.addCell (row, 1, "task show [section-name]"); - table.addCell (row, 2, "Shows the task entire configuration or a specific section."); + table.addCell (row, 1, "task show [all | substring]"); + table.addCell (row, 2, "Shows the entire task configuration variables or the ones containing substring."); row = table.addRow (); table.addCell (row, 1, "task config [name [value | '']]");