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.
+ 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.

16
NEWS
View file

@ -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.

View file

@ -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 | '']]

View file

@ -614,6 +614,9 @@ int handleShow (std::string &outs)
std::vector <std::string> 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 <std::string> 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");

View file

@ -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 | '']]");