mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Commands
- Eliminated the Command::implements method. - Implemented CmdCustom to handle all custom reports. - Implemented CmdTags.
This commit is contained in:
parent
31e865e823
commit
bedc28f517
18 changed files with 575 additions and 129 deletions
|
@ -27,13 +27,9 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <CmdExec.h>
|
||||
#include <Context.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdExec::CmdExec ()
|
||||
: _external_command ("")
|
||||
{
|
||||
_keyword = "execute";
|
||||
_usage = "task execute <external command>";
|
||||
|
@ -43,36 +39,9 @@ CmdExec::CmdExec ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CmdExec::implements (const std::string& command_line)
|
||||
int CmdExec::execute (const std::string& command_line, std::string& output)
|
||||
{
|
||||
_external_command = "";
|
||||
if (context.args.size () > 1 &&
|
||||
(context.args[0] == "execute" ||
|
||||
context.args[0] == "execut" ||
|
||||
context.args[0] == "execu" ||
|
||||
context.args[0] == "exec" ||
|
||||
context.args[0] == "exe" ||
|
||||
context.args[0] == "ex"))
|
||||
{
|
||||
for (int i = 1; i < context.args.size (); ++i)
|
||||
{
|
||||
if (i > 1)
|
||||
_external_command += " ";
|
||||
|
||||
_external_command += context.args[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdExec::execute (const std::string&, std::string&)
|
||||
{
|
||||
system (_external_command.c_str ());
|
||||
return 0;
|
||||
return system (command_line.c_str ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue