Feature - simple version report for scripts

- Added a simple _version command that displays only the version
  number and a newline.  This makes it easier for external task support
  scripts to determine which version of task is installed - easier than
  parsing the version command output.
This commit is contained in:
Paul Beckingham 2009-12-18 21:41:48 -05:00
parent be86c52dc0
commit 2ec5a315cb
4 changed files with 14 additions and 0 deletions

View file

@ -110,6 +110,7 @@ void Cmd::load ()
commands.push_back ("_commands"); commands.push_back ("_commands");
commands.push_back ("_ids"); commands.push_back ("_ids");
commands.push_back ("_config"); commands.push_back ("_config");
commands.push_back ("_version");
commands.push_back (context.stringtable.get (CMD_ADD, "add")); commands.push_back (context.stringtable.get (CMD_ADD, "add"));
commands.push_back (context.stringtable.get (CMD_APPEND, "append")); commands.push_back (context.stringtable.get (CMD_APPEND, "append"));
commands.push_back (context.stringtable.get (CMD_ANNOTATE, "annotate")); commands.push_back (context.stringtable.get (CMD_ANNOTATE, "annotate"));
@ -192,6 +193,7 @@ bool Cmd::isReadOnlyCommand ()
command == "_commands" || command == "_commands" ||
command == "_ids" || command == "_ids" ||
command == "_config" || command == "_config" ||
command == "_version" ||
command == context.stringtable.get (CMD_CALENDAR, "calendar") || command == context.stringtable.get (CMD_CALENDAR, "calendar") ||
command == context.stringtable.get (CMD_COLORS, "colors") || command == context.stringtable.get (CMD_COLORS, "colors") ||
command == context.stringtable.get (CMD_EXPORT, "export") || command == context.stringtable.get (CMD_EXPORT, "export") ||

View file

@ -221,6 +221,7 @@ int Context::dispatch (std::string &out)
else if (cmd.command == "_commands") { rc = handleCompletionCommands (out); } else if (cmd.command == "_commands") { rc = handleCompletionCommands (out); }
else if (cmd.command == "_ids") { rc = handleCompletionIDs (out); } else if (cmd.command == "_ids") { rc = handleCompletionIDs (out); }
else if (cmd.command == "_config") { rc = handleCompletionConfig (out); } else if (cmd.command == "_config") { rc = handleCompletionConfig (out); }
else if (cmd.command == "_version") { rc = handleCompletionVersion (out); }
else if (cmd.command == "" && else if (cmd.command == "" &&
sequence.size ()) { rc = handleModify (out); } sequence.size ()) { rc = handleModify (out); }

View file

@ -373,6 +373,16 @@ int handleCompletionConfig (std::string &outs)
return 0; return 0;
} }
////////////////////////////////////////////////////////////////////////////////
// A simple version display for use by completion scripts and the task-update
// script.
int handleCompletionVersion (std::string &outs)
{
outs = VERSION;
outs += "\n";
return 0;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int handleCompletionIDs (std::string &outs) int handleCompletionIDs (std::string &outs)
{ {

View file

@ -68,6 +68,7 @@ int handleCompletionTags (std::string &);
int handleCompletionCommands (std::string &); int handleCompletionCommands (std::string &);
int handleCompletionIDs (std::string &); int handleCompletionIDs (std::string &);
int handleCompletionConfig (std::string &); int handleCompletionConfig (std::string &);
int handleCompletionVersion (std::string &);
int handleVersion (std::string &); int handleVersion (std::string &);
int handleDelete (std::string &); int handleDelete (std::string &);
int handleStart (std::string &); int handleStart (std::string &);