diff --git a/AUTHORS b/AUTHORS index 8e818aed5..9f9f8182e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -157,4 +157,4 @@ suggestions: Rene Vergara Stéphane Pezennec Jim B - + Jake Bell diff --git a/ChangeLog b/ChangeLog index e7d79bc16..ba29205bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ Features tasks to the 'statistics' command output (thanks to T. Charles Yun). + Added Feature #1069, which gives a clearer error when a UDA is added without the uda..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 repetition by not printing parent names in front of children names. + Added framework for testing bash autocompletion. diff --git a/doc/man/task.1.in b/doc/man/task.1.in index 70b2a58fb..2cbf974f7 100644 --- a/doc/man/task.1.in +++ b/doc/man/task.1.in @@ -492,6 +492,11 @@ Lists all supported configuration variables, for completion purposes. .B task _ids 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 .B task _uuids Shows only the UUIDs of matching tasks among all tasks (even deleted and diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index 270149a36..92cc1d421 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -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 all; + context.config.all (all); + + // Sort alphabetically by name. + std::sort (all.begin (), all.end ()); + + // Display them all. + std::vector ::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; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdShow.h b/src/commands/CmdShow.h index afa71f6ee..e503b77df 100644 --- a/src/commands/CmdShow.h +++ b/src/commands/CmdShow.h @@ -39,5 +39,12 @@ public: int execute (std::string&); }; +class CmdShowRaw : public Command +{ +public: + CmdShowRaw (); + int execute (std::string&); +}; + #endif //////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 01bea08a4..330e57032 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -154,6 +154,7 @@ void Command::factory (std::map & all) c = new CmdReports (); all[c->keyword ()] = c; c = new CmdShell (); 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 CmdStats (); all[c->keyword ()] = c; c = new CmdStop (); all[c->keyword ()] = c; diff --git a/src/en-US.h b/src/en-US.h index ccca19347..ce24810d4 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -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_CONF_VAR "Config Variable" #define STRING_CMD_SHOW_CONF_VALUE "Value" +#define STRING_CMD_SHOWRAW "Shows all configuration settings in a machine-readable format" // Task #define STRING_TASK_NO_FF1 "Taskwarrior no longer supports file format 1, originally used between 27 November 2006 and 31 December 2007." diff --git a/src/es-ES.h b/src/es-ES.h index 4f27f444a..018950509 100644 --- a/src/es-ES.h +++ b/src/es-ES.h @@ -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_CONF_VAR "Variable Config" #define STRING_CMD_SHOW_CONF_VALUE "Valor" +#define STRING_CMD_SHOWRAW "Shows all configuration settings in a machine-readable format" // 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."