Enhancement - #407 show command

- finalized the implementation
- a searchstring can now be supplied to limit the display
  of configuration settings
This commit is contained in:
Federico Hernandez 2010-06-08 22:38:35 +02:00
parent c93db168f3
commit d37c798dbc
5 changed files with 31 additions and 32 deletions

View file

@ -12,6 +12,9 @@
command. command.
+ Added feature #390, an extra dateformat for annotations (thanks to Cory + Added feature #390, an extra dateformat for annotations (thanks to Cory
Donnelly). 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 + Fixed bug #406 so that task now includes command aliases in the _commands
helper command used by shell completion scripts. helper command used by shell completion scripts.
+ Fixed bug #211 - it was unclear which commands modify a task description. + Fixed bug #211 - it was unclear which commands modify a task description.

16
NEWS
View file

@ -1,25 +1,11 @@
New Features in task 1.9 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 'log' command to add tasks that are already completed.
- New annual history and ghistory command variations. - New annual history and ghistory command variations.
- Alias support in shell completion scripts. - Alias support in shell completion scripts.
- New iCalendar export format. - 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 Please refer to the ChangeLog file for full details. There are too many to
list here. list here.

View file

@ -130,10 +130,9 @@ Shows the task version number
Shows the long usage text. Shows the long usage text.
.TP .TP
.B show .B show [all | substring]"
Shows the current settings in the task configuration file. If a section-name is Shows all the current settings in the task configuration file. If a substring
specified just the settings for the particular section will be displayed. is specified just the settings containing that substring will be displayed.
Section-names are: alias, calendar, color, general, holiday, report.
.TP .TP
.B config [name [value | '']] .B config [name [value | '']]

View file

@ -614,6 +614,9 @@ int handleShow (std::string &outs)
std::vector <std::string> args; std::vector <std::string> args;
split (args, context.task.get ("description"), ' '); 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 (); int width = context.getWidth ();
std::vector <std::string> all; std::vector <std::string> all;
@ -696,21 +699,29 @@ int handleShow (std::string &outs)
table.sortOn (0, Table::ascendingCharacter); table.sortOn (0, Table::ascendingCharacter);
Color error ("bold white on red"); Color error ("bold white on red");
std::string section;
if (args.size () == 1)
section = args[0];
if (section == "all")
section = "";
foreach (i, all) 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 if (loc != std::string::npos)
// TODO depending on argument to the show command {
// TODO alias, calendar, color, general, holiday, report int row = table.addRow ();
table.addCell (row, 0, *i);
table.addCell (row, 1, context.config.get (*i));
int row = table.addRow (); if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
table.addCell (row, 0, *i); if (std::find (unrecognized.begin (), unrecognized.end (), *i) != unrecognized.end ())
table.addCell (row, 1, value); 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"); Color bold ("bold");

View file

@ -207,8 +207,8 @@ int shortUsage (std::string &outs)
table.addCell (row, 2, "Shows the task version number."); table.addCell (row, 2, "Shows the task version number.");
row = table.addRow (); row = table.addRow ();
table.addCell (row, 1, "task show [section-name]"); table.addCell (row, 1, "task show [all | substring]");
table.addCell (row, 2, "Shows the task entire configuration or a specific section."); table.addCell (row, 2, "Shows the entire task configuration variables or the ones containing substring.");
row = table.addRow (); row = table.addRow ();
table.addCell (row, 1, "task config [name [value | '']]"); table.addCell (row, 1, "task config [name [value | '']]");