mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Commands
- New 'exec' command that runs external programs, implemented by CmdExec. - Restructured code so that only Commands implements ::read_only and ::displays_id methods, while derived objects simply set flags. - Corrected column alignment in summary report.
This commit is contained in:
parent
52599dca63
commit
afc97d566c
11 changed files with 63 additions and 49 deletions
|
@ -25,7 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <CmdExec.h>
|
||||
#include <Context.h>
|
||||
|
||||
|
@ -33,26 +33,39 @@ extern Context context;
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdExec::CmdExec ()
|
||||
: _external_command ("")
|
||||
{
|
||||
_read_only = false;
|
||||
_displays_id = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdExec::~CmdExec ()
|
||||
bool CmdExec::implements (const std::string& command_line)
|
||||
{
|
||||
}
|
||||
if (context.args.size () > 1 &&
|
||||
(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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CmdExec::implements (const std::string& command_line) const
|
||||
{
|
||||
std::cout << "# CmdExec::implements\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdExec::execute (const std::string& commandLine, std::string& output)
|
||||
int CmdExec::execute (const std::string&, std::string&)
|
||||
{
|
||||
std::cout << "# CmdExec::execute\n";
|
||||
return 1;
|
||||
system (_external_command.c_str ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue