mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-25 21:27:19 +02:00
Commands
- Migrated the _version command from handleCompletionVersion to CmdVersion.
This commit is contained in:
parent
fc77e04b54
commit
54d98a6b2d
8 changed files with 40 additions and 29 deletions
|
@ -242,10 +242,6 @@ int CmdHelp::execute (const std::string& command_line, std::string& output)
|
|||
view.set (row, 1, "task ids [filter]");
|
||||
view.set (row, 2, "Shows only the IDs of matching tasks, in the form of a range.");
|
||||
|
||||
row = view.addRow ();
|
||||
view.set (row, 1, "task version");
|
||||
view.set (row, 2, "Shows the task version number.");
|
||||
|
||||
row = view.addRow ();
|
||||
view.set (row, 1, "task show [all | substring]");
|
||||
view.set (row, 2, "Shows the entire task configuration variables or the ones containing substring.");
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <Context.h>
|
||||
#include <ViewText.h>
|
||||
#include <cmake.h>
|
||||
#include <commit.h>
|
||||
#include <CmdVersion.h>
|
||||
|
||||
extern Context context;
|
||||
|
@ -117,3 +118,27 @@ int CmdVersion::execute (const std::string& command_line, std::string& output)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdCompletionVersion::CmdCompletionVersion ()
|
||||
{
|
||||
_keyword = "_version";
|
||||
_usage = "task _version";
|
||||
_description = "Shows only the taskwarrior version number.";
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdCompletionVersion::execute (
|
||||
const std::string& command_line,
|
||||
std::string& output)
|
||||
{
|
||||
#ifdef HAVE_COMMIT
|
||||
output = COMMIT;
|
||||
#else
|
||||
output = VERSION;
|
||||
#endif
|
||||
output += "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -37,5 +37,12 @@ public:
|
|||
int execute (const std::string&, std::string&);
|
||||
};
|
||||
|
||||
class CmdCompletionVersion : public Command
|
||||
{
|
||||
public:
|
||||
CmdCompletionVersion ();
|
||||
int execute (const std::string&, std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -45,13 +45,14 @@ void Command::factory (std::map <std::string, Command*>& all)
|
|||
{
|
||||
Command* c;
|
||||
|
||||
c = new CmdExec (); all[c->keyword ()] = c;
|
||||
c = new CmdHelp (); all[c->keyword ()] = c;
|
||||
c = new CmdInstall (); all[c->keyword ()] = c;
|
||||
c = new CmdLogo (); all[c->keyword ()] = c;
|
||||
c = new CmdTags (); all[c->keyword ()] = c;
|
||||
c = new CmdTip (); all[c->keyword ()] = c;
|
||||
c = new CmdVersion (); all[c->keyword ()] = c;
|
||||
c = new CmdExec (); all[c->keyword ()] = c;
|
||||
c = new CmdHelp (); all[c->keyword ()] = c;
|
||||
c = new CmdInstall (); all[c->keyword ()] = c;
|
||||
c = new CmdLogo (); all[c->keyword ()] = c;
|
||||
c = new CmdTags (); all[c->keyword ()] = c;
|
||||
c = new CmdTip (); all[c->keyword ()] = c;
|
||||
c = new CmdVersion (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionVersion (); all[c->keyword ()] = c;
|
||||
|
||||
// Instantiate a command object for each custom report.
|
||||
std::vector <std::string> variables;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue