- Added '_show' command to generate a machine-readable configuration settings
  list for use by third-party software (thanks to Jake Bell).
This commit is contained in:
Paul Beckingham 2012-11-17 12:45:44 -05:00
parent 973e0ed56b
commit 92c3f0862d
8 changed files with 49 additions and 1 deletions

View file

@ -157,4 +157,4 @@ suggestions:
Rene Vergara Rene Vergara
Stéphane Pezennec Stéphane Pezennec
Jim B Jim B
Jake Bell

View file

@ -9,6 +9,9 @@ Features
tasks to the 'statistics' command output (thanks to T. Charles Yun). tasks to the 'statistics' command output (thanks to T. Charles Yun).
+ Added Feature #1069, which gives a clearer error when a UDA + Added Feature #1069, which gives a clearer error when a UDA
is added without the uda.<uda-name>.type variable. is added without the uda.<uda-name>.type variable.
+ Added Feature #1124, which provides a '_show' command that displays all
configuration defaults and settings, for use by third-party software (thanks
to Jake Bell).
+ The 'projects' command now outputs abstract parents and reduces + The 'projects' command now outputs abstract parents and reduces
repetition by not printing parent names in front of children names. repetition by not printing parent names in front of children names.
+ Added framework for testing bash autocompletion. + Added framework for testing bash autocompletion.

View file

@ -492,6 +492,11 @@ Lists all supported configuration variables, for completion purposes.
.B task <filter> _ids .B task <filter> _ids
Shows only the IDs of matching tasks, in the form of a list. Shows only the IDs of matching tasks, in the form of a list.
.TP
.B task _show
Shows the combined defaults and overrides of the configuration settings, for use
by third-party applications.
.TP .TP
.B task <filter> _uuids .B task <filter> _uuids
Shows only the UUIDs of matching tasks among all tasks (even deleted and Shows only the UUIDs of matching tasks among all tasks (even deleted and

View file

@ -438,3 +438,33 @@ int CmdShow::execute (std::string& output)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CmdShowRaw::CmdShowRaw ()
{
_keyword = "_show";
_usage = "task _show";
_description = STRING_CMD_SHOWRAW;
_read_only = true;
_displays_id = false;
}
////////////////////////////////////////////////////////////////////////////////
int CmdShowRaw::execute (std::string& output)
{
// Get all the settings.
std::vector <std::string> all;
context.config.all (all);
// Sort alphabetically by name.
std::sort (all.begin (), all.end ());
// Display them all.
std::vector <std::string>::iterator i;
std::stringstream out;
for (i = all.begin (); i != all.end (); ++i)
out << *i << '=' << context.config.get (*i) << "\n";
output = out.str ();
return 0;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -39,5 +39,12 @@ public:
int execute (std::string&); int execute (std::string&);
}; };
class CmdShowRaw : public Command
{
public:
CmdShowRaw ();
int execute (std::string&);
};
#endif #endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -154,6 +154,7 @@ void Command::factory (std::map <std::string, Command*>& all)
c = new CmdReports (); all[c->keyword ()] = c; c = new CmdReports (); all[c->keyword ()] = c;
c = new CmdShell (); all[c->keyword ()] = c; c = new CmdShell (); all[c->keyword ()] = c;
c = new CmdShow (); all[c->keyword ()] = c; c = new CmdShow (); all[c->keyword ()] = c;
c = new CmdShowRaw (); all[c->keyword ()] = c;
c = new CmdStart (); all[c->keyword ()] = c; c = new CmdStart (); all[c->keyword ()] = c;
c = new CmdStats (); all[c->keyword ()] = c; c = new CmdStats (); all[c->keyword ()] = c;
c = new CmdStop (); all[c->keyword ()] = c; c = new CmdStop (); all[c->keyword ()] = c;

View file

@ -772,6 +772,7 @@
#define STRING_CMD_SHOW_LOC_EXIST "Configuration error: data.location contains a directory name that doesn't exist, or is unreadable." #define STRING_CMD_SHOW_LOC_EXIST "Configuration error: data.location contains a directory name that doesn't exist, or is unreadable."
#define STRING_CMD_SHOW_CONF_VAR "Config Variable" #define STRING_CMD_SHOW_CONF_VAR "Config Variable"
#define STRING_CMD_SHOW_CONF_VALUE "Value" #define STRING_CMD_SHOW_CONF_VALUE "Value"
#define STRING_CMD_SHOWRAW "Shows all configuration settings in a machine-readable format"
// Task // Task
#define STRING_TASK_NO_FF1 "Taskwarrior no longer supports file format 1, originally used between 27 November 2006 and 31 December 2007." #define STRING_TASK_NO_FF1 "Taskwarrior no longer supports file format 1, originally used between 27 November 2006 and 31 December 2007."

View file

@ -787,6 +787,7 @@
#define STRING_CMD_SHOW_LOC_EXIST "Error de configuración: data.location contiene un nombre de directorio que no existe o no se puede leer." #define STRING_CMD_SHOW_LOC_EXIST "Error de configuración: data.location contiene un nombre de directorio que no existe o no se puede leer."
#define STRING_CMD_SHOW_CONF_VAR "Variable Config" #define STRING_CMD_SHOW_CONF_VAR "Variable Config"
#define STRING_CMD_SHOW_CONF_VALUE "Valor" #define STRING_CMD_SHOW_CONF_VALUE "Valor"
#define STRING_CMD_SHOWRAW "Shows all configuration settings in a machine-readable format"
// Task // Task
#define STRING_TASK_NO_FF1 "Taskwarrior ya no admite el formato de archivo 1, usado originalmente entre el 27 de noviembre del 2006 y el 31 de diciembre del 2007." #define STRING_TASK_NO_FF1 "Taskwarrior ya no admite el formato de archivo 1, usado originalmente entre el 27 de noviembre del 2006 y el 31 de diciembre del 2007."