Argument Parsing

- Obsoleted Command::exectute  'commandLine' argument.  It is worse
  than unnecessary, it is an uncategorized raw argument string, which
  is only really useful for the 'execute' command, which itself now
  calls Arguments::combine to reconstruct the command line string.
This commit is contained in:
Paul Beckingham 2011-06-04 12:28:50 -04:00
parent c2e1757fb6
commit 644d027a87
99 changed files with 397 additions and 289 deletions

View file

@ -46,7 +46,7 @@ CmdAdd::CmdAdd ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdAdd::execute (const std::string&, std::string& output)
int CmdAdd::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdAdd : public Command
{
public:
CmdAdd ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -44,7 +44,7 @@ CmdAnnotate::CmdAnnotate ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdAnnotate::execute (const std::string&, std::string& output)
int CmdAnnotate::execute (std::string& output)
{
int rc = 0;

View file

@ -35,7 +35,7 @@ class CmdAnnotate : public Command
{
public:
CmdAnnotate ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -44,7 +44,7 @@ CmdAppend::CmdAppend ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdAppend::execute (const std::string&, std::string& output)
int CmdAppend::execute (std::string& output)
{
if (!context.task.has ("description"))
throw std::string ("Additional text must be provided.");

View file

@ -35,7 +35,7 @@ class CmdAppend : public Command
{
public:
CmdAppend ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -978,7 +978,7 @@ CmdBurndownMonthly::CmdBurndownMonthly ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdBurndownMonthly::execute (const std::string&, std::string& output)
int CmdBurndownMonthly::execute (std::string& output)
{
int rc = 0;
@ -1031,7 +1031,7 @@ CmdBurndownWeekly::CmdBurndownWeekly ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdBurndownWeekly::execute (const std::string&, std::string& output)
int CmdBurndownWeekly::execute (std::string& output)
{
int rc = 0;
@ -1084,7 +1084,7 @@ CmdBurndownDaily::CmdBurndownDaily ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdBurndownDaily::execute (const std::string&, std::string& output)
int CmdBurndownDaily::execute (std::string& output)
{
int rc = 0;

View file

@ -35,21 +35,21 @@ class CmdBurndownMonthly : public Command
{
public:
CmdBurndownMonthly ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdBurndownWeekly : public Command
{
public:
CmdBurndownWeekly ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdBurndownDaily : public Command
{
public:
CmdBurndownDaily ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -48,7 +48,7 @@ CmdCalendar::CmdCalendar ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCalendar::execute (const std::string&, std::string& output)
int CmdCalendar::execute (std::string& output)
{
int rc = 0;
@ -114,8 +114,9 @@ int CmdCalendar::execute (const std::string&, std::string& output)
int argMonth = 0;
int argYear = 0;
bool argWholeYear = false;
std::vector <std::string> args = context.args.list ();
std::vector <std::string>::iterator arg;
for (arg = context.args.begin (); arg != context.args.end (); ++arg)
for (arg = args.begin (); arg != args.end (); ++arg)
{
// Some version of "calendar".
if (autoComplete (lowerCase (*arg), commandNames, matches) == 1)
@ -353,7 +354,7 @@ int CmdCalendar::execute (const std::string&, std::string& output)
context.sequence.clear ();
std::string output;
context.commands[report]->execute (context.commandLine, output);
context.commands[report]->execute (output);
out << output;
}

View file

@ -38,7 +38,7 @@ class CmdCalendar : public Command
{
public:
CmdCalendar ();
int execute (const std::string&, std::string&);
int execute (std::string&);
private:
std::string renderMonths (int, int, const Date&, std::vector <Task>&, int);

View file

@ -44,7 +44,7 @@ CmdColor::CmdColor ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdColor::execute (const std::string&, std::string& output)
int CmdColor::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdColor : public Command
{
public:
CmdColor ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,7 +45,7 @@ CmdCompletionCommands::CmdCompletionCommands ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCompletionCommands::execute (const std::string&, std::string& output)
int CmdCompletionCommands::execute (std::string& output)
{
// Get a list of all commands.
std::vector <std::string> commands;
@ -81,7 +81,7 @@ CmdZshCommands::CmdZshCommands ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdZshCommands::execute (const std::string&, std::string& output)
int CmdZshCommands::execute (std::string& output)
{
// Get a list of all commands.
std::vector <std::string> commands;

View file

@ -35,14 +35,14 @@ class CmdCompletionCommands : public Command
{
public:
CmdCompletionCommands ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdZshCommands : public Command
{
public:
CmdZshCommands ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,9 +45,12 @@ CmdConfig::CmdConfig ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdConfig::execute (const std::string&, std::string& output)
int CmdConfig::execute (std::string& output)
{
int rc = 0;
/*
TODO Revise argument handling
std::stringstream out;
// Obtain the arguments from the description. That way, things like '--'
@ -160,6 +163,7 @@ int CmdConfig::execute (const std::string&, std::string& output)
}
else
throw std::string ("Specify the name of a config variable to modify.");
*/
return rc;
}
@ -176,7 +180,7 @@ CmdCompletionConfig::CmdCompletionConfig ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCompletionConfig::execute (const std::string&, std::string& output)
int CmdCompletionConfig::execute (std::string& output)
{
std::vector <std::string> configs;
context.config.all (configs);

View file

@ -35,14 +35,14 @@ class CmdConfig : public Command
{
public:
CmdConfig ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdCompletionConfig : public Command
{
public:
CmdCompletionConfig ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -43,7 +43,7 @@ CmdCount::CmdCount ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCount::execute (const std::string&, std::string& output)
int CmdCount::execute (std::string& output)
{
// Scan the pending tasks, applying any filter.
std::vector <Task> tasks;

View file

@ -35,7 +35,7 @@ class CmdCount : public Command
{
public:
CmdCount ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -51,7 +51,7 @@ CmdCustom::CmdCustom (
}
////////////////////////////////////////////////////////////////////////////////
int CmdCustom::execute (const std::string&, std::string& output)
int CmdCustom::execute (std::string& output)
{
int rc = 0;
@ -128,7 +128,6 @@ int CmdCustom::execute (const std::string&, std::string& output)
////////////////////////////////////
// TODO Create the filter
context.args.remove_command (_keyword);
//std::vector <std::string> filter_args;
//context.args.extract_filter (filter_args);

View file

@ -35,7 +35,7 @@ class CmdCustom : public Command
{
public:
CmdCustom (const std::string&, const std::string&, const std::string&);
int execute (const std::string&, std::string&);
int execute (std::string&);
private:
void validateReportColumns (std::vector <std::string>&);

View file

@ -45,7 +45,7 @@ CmdDelete::CmdDelete ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDelete::execute (const std::string&, std::string& output)
int CmdDelete::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdDelete : public Command
{
public:
CmdDelete ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,7 +45,7 @@ CmdDenotate::CmdDenotate ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDenotate::execute (const std::string&, std::string& output)
int CmdDenotate::execute (std::string& output)
{
int rc = 0;

View file

@ -35,7 +35,7 @@ class CmdDenotate : public Command
{
public:
CmdDenotate ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -63,7 +63,7 @@ CmdDiagnostics::CmdDiagnostics ()
//
// Although this will change over time, initially this command will answer the
// kind of questions we always have to ask whenever something is wrong.
int CmdDiagnostics::execute (const std::string&, std::string& output)
int CmdDiagnostics::execute (std::string& output)
{
Color bold ("bold");

View file

@ -35,7 +35,7 @@ class CmdDiagnostics : public Command
{
public:
CmdDiagnostics ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -44,7 +44,7 @@ CmdDone::CmdDone ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDone::execute (const std::string&, std::string& output)
int CmdDone::execute (std::string& output)
{
int rc = 0;
int count = 0;

View file

@ -35,7 +35,7 @@ class CmdDone : public Command
{
public:
CmdDone ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,7 +45,7 @@ CmdDuplicate::CmdDuplicate ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDuplicate::execute (const std::string&, std::string& output)
int CmdDuplicate::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdDuplicate : public Command
{
public:
CmdDuplicate ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -52,7 +52,7 @@ CmdEdit::CmdEdit ()
// Introducing the Silver Bullet. This feature is the catch-all fixative for
// various other ills. This is like opening up the hood and going in with a
// wrench. To be used sparingly.
int CmdEdit::execute (const std::string&, std::string& output)
int CmdEdit::execute (std::string& output)
{
int rc = 0;

View file

@ -36,7 +36,7 @@ class CmdEdit : public Command
{
public:
CmdEdit ();
int execute (const std::string&, std::string&);
int execute (std::string&);
private:
std::string findValue (const std::string&, const std::string&);

View file

@ -26,8 +26,11 @@
////////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <Context.h>
#include <CmdExec.h>
extern Context context;
////////////////////////////////////////////////////////////////////////////////
CmdExec::CmdExec ()
{
@ -39,8 +42,17 @@ CmdExec::CmdExec ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdExec::execute (const std::string& command_line, std::string&)
int CmdExec::execute (std::string& output)
{
std::string command_line;
std::vector <std::pair <std::string, std::string> >::iterator arg;
for (arg = context.args.begin (); arg != context.args.end (); ++arg)
{
if (arg != context.args.begin () &&
arg->first != "execute")
command_line += arg->first;
}
return system (command_line.c_str ());
}

View file

@ -35,7 +35,7 @@ class CmdExec : public Command
{
public:
CmdExec ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -44,7 +44,7 @@ CmdHelp::CmdHelp ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdHelp::execute (const std::string&, std::string& output)
int CmdHelp::execute (std::string& output)
{
ViewText view;
view.width (context.getWidth ());

View file

@ -35,7 +35,7 @@ class CmdHelp : public Command
{
public:
CmdHelp ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -38,7 +38,6 @@ extern Context context;
CmdHistoryMonthly::CmdHistoryMonthly ()
{
_keyword = "history.monthly";
_usage = "task execute <external command>";
_usage = "task history.monthly [<filter>]";
_description = "Shows a report of task history, by month.";
_read_only = true;
@ -46,7 +45,7 @@ CmdHistoryMonthly::CmdHistoryMonthly ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdHistoryMonthly::execute (const std::string&, std::string& output)
int CmdHistoryMonthly::execute (std::string& output)
{
int rc = 0;
std::map <time_t, int> groups; // Represents any month with data
@ -202,7 +201,7 @@ CmdHistoryAnnual::CmdHistoryAnnual ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdHistoryAnnual::execute (const std::string&, std::string& output)
int CmdHistoryAnnual::execute (std::string& output)
{
int rc = 0;
std::map <time_t, int> groups; // Represents any month with data
@ -355,7 +354,7 @@ CmdGHistoryMonthly::CmdGHistoryMonthly ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdGHistoryMonthly::execute (const std::string&, std::string& output)
int CmdGHistoryMonthly::execute (std::string& output)
{
int rc = 0;
std::map <time_t, int> groups; // Represents any month with data
@ -551,7 +550,7 @@ CmdGHistoryAnnual::CmdGHistoryAnnual ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdGHistoryAnnual::execute (const std::string&, std::string& output)
int CmdGHistoryAnnual::execute (std::string& output)
{
int rc = 0;
std::map <time_t, int> groups; // Represents any month with data

View file

@ -35,28 +35,28 @@ class CmdHistoryMonthly : public Command
{
public:
CmdHistoryMonthly ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdHistoryAnnual : public Command
{
public:
CmdHistoryAnnual ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdGHistoryMonthly : public Command
{
public:
CmdGHistoryMonthly ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdGHistoryAnnual : public Command
{
public:
CmdGHistoryAnnual ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,7 +45,7 @@ CmdIDs::CmdIDs ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdIDs::execute (const std::string&, std::string& output)
int CmdIDs::execute (std::string& output)
{
// Scan the pending tasks, applying any filter.
std::vector <Task> tasks;
@ -78,7 +78,7 @@ CmdCompletionIds::CmdCompletionIds ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCompletionIds::execute (const std::string&, std::string& output)
int CmdCompletionIds::execute (std::string& output)
{
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));
@ -116,7 +116,7 @@ CmdZshCompletionIds::CmdZshCompletionIds ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdZshCompletionIds::execute (const std::string&, std::string& output)
int CmdZshCompletionIds::execute (std::string& output)
{
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));

View file

@ -35,21 +35,21 @@ class CmdIDs : public Command
{
public:
CmdIDs ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdCompletionIds : public Command
{
public:
CmdCompletionIds ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdZshCompletionIds : public Command
{
public:
CmdZshCompletionIds ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -739,6 +739,7 @@ std::string CmdImport::todoSh_2_0 (const std::vector <std::string>& lines)
std::vector <std::string>::const_iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
{
/*
try
{
context.args.clear ();
@ -802,12 +803,10 @@ std::string CmdImport::todoSh_2_0 (const std::vector <std::string>& lines)
}
}
/*
context.task.clear ();
context.cmd.command = "";
context.parse ();
decorateTask (context.task);
*/
// context.task.clear ();
// context.cmd.command = "";
// context.parse ();
// decorateTask (context.task);
// Override the Task::pending that decorateTask applies.
if (!isPending)
@ -837,6 +836,7 @@ std::string CmdImport::todoSh_2_0 (const std::vector <std::string>& lines)
context.clearMessages ();
failed.push_back (*it);
}
*/
}
context.tdb.commit ();
@ -869,6 +869,7 @@ std::string CmdImport::text (const std::vector <std::string>& lines)
std::vector <std::string>::const_iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
{
/*
std::string line = *it;
// Strip comments
@ -885,12 +886,10 @@ std::string CmdImport::text (const std::vector <std::string>& lines)
context.args.clear ();
split (context.args, std::string ("add ") + line, ' ');
/*
context.task.clear ();
context.cmd.command = "";
context.parse ();
decorateTask (context.task);
*/
// context.task.clear ();
// context.cmd.command = "";
// context.parse ();
// decorateTask (context.task);
context.tdb.add (context.task);
context.clearMessages ();
@ -902,6 +901,7 @@ std::string CmdImport::text (const std::vector <std::string>& lines)
failed.push_back (line);
}
}
*/
}
context.tdb.commit ();
@ -1284,7 +1284,7 @@ std::string CmdImport::YAML (const std::vector <std::string>& lines)
}
////////////////////////////////////////////////////////////////////////////////
int CmdImport::execute (const std::string&, std::string& output)
int CmdImport::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdImport : public Command
{
public:
CmdImport ();
int execute (const std::string&, std::string&);
int execute (std::string&);
private:
enum fileType

View file

@ -47,7 +47,7 @@ CmdInfo::CmdInfo ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdInfo::execute (const std::string&, std::string& output)
int CmdInfo::execute (std::string& output)
{
int rc = 0;

View file

@ -35,7 +35,7 @@ class CmdInfo : public Command
{
public:
CmdInfo ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -47,7 +47,7 @@ CmdInstall::CmdInstall ()
// Generate UUID
// Call the "install" function once, store results in rc:
// extension.<uuid>=<JSON>
int CmdInstall::execute (const std::string&, std::string&)
int CmdInstall::execute (std::string&)
{
return 1;
}

View file

@ -35,7 +35,7 @@ class CmdInstall : public Command
{
public:
CmdInstall ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,7 +45,7 @@ CmdLog::CmdLog ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdLog::execute (const std::string&, std::string& output)
int CmdLog::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdLog : public Command
{
public:
CmdLog ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -47,7 +47,7 @@ CmdLogo::CmdLogo ()
// Generate UUID
// Call the "install" function once, store results in rc:
// extension.<uuid>=<JSON>
int CmdLogo::execute (const std::string&, std::string& output)
int CmdLogo::execute (std::string& output)
{
static const char* data[] =
{

View file

@ -35,7 +35,7 @@ class CmdLogo : public Command
{
public:
CmdLogo ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -47,7 +47,7 @@ CmdMerge::CmdMerge ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdMerge::execute (const std::string&, std::string& output)
int CmdMerge::execute (std::string& output)
{
std::string file = trim (context.task.get ("description"));
std::string pushfile = "";
@ -93,7 +93,7 @@ int CmdMerge::execute (const std::string&, std::string& output)
context.task.set ("description", uri.data);
std::string out;
context.commands["push"]->execute ("", out);
context.commands["push"]->execute (out);
}
}
else

View file

@ -35,7 +35,7 @@ class CmdMerge : public Command
{
public:
CmdMerge ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -48,7 +48,7 @@ CmdModify::CmdModify ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdModify::execute (const std::string&, std::string& output)
int CmdModify::execute (std::string& output)
{
int count = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdModify : public Command
{
public:
CmdModify ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -44,7 +44,7 @@ CmdPrepend::CmdPrepend ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdPrepend::execute (const std::string&, std::string& output)
int CmdPrepend::execute (std::string& output)
{
if (!context.task.has ("description"))
throw std::string ("Additional text must be provided.");

View file

@ -35,7 +35,7 @@ class CmdPrepend : public Command
{
public:
CmdPrepend ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -44,7 +44,7 @@ CmdProjects::CmdProjects ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdProjects::execute (const std::string&, std::string& output)
int CmdProjects::execute (std::string& output)
{
int rc = 0;
std::stringstream out;
@ -142,7 +142,7 @@ CmdCompletionProjects::CmdCompletionProjects ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCompletionProjects::execute (const std::string&, std::string& output)
int CmdCompletionProjects::execute (std::string& output)
{
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));

View file

@ -35,14 +35,14 @@ class CmdProjects : public Command
{
public:
CmdProjects ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdCompletionProjects : public Command
{
public:
CmdCompletionProjects ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -46,7 +46,7 @@ CmdPull::CmdPull ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdPull::execute (const std::string&, std::string& output)
int CmdPull::execute (std::string& output)
{
std::string file = trim (context.task.get ("description"));

View file

@ -35,7 +35,7 @@ class CmdPull : public Command
{
public:
CmdPull ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -48,7 +48,7 @@ CmdPush::CmdPush ()
////////////////////////////////////////////////////////////////////////////////
// Transfers the local data (from rc.location.data) to the remote path. Because
// this is potentially on another machine, no checking can be performed.
int CmdPush::execute (const std::string&, std::string& output)
int CmdPush::execute (std::string& output)
{
std::string file = trim (context.task.get ("description"));

View file

@ -35,7 +35,7 @@ class CmdPush : public Command
{
public:
CmdPush ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -42,7 +42,7 @@ CmdQuery::CmdQuery ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdQuery::execute (const std::string&, std::string& output)
int CmdQuery::execute (std::string& output)
{
int rc = 0;

View file

@ -35,7 +35,7 @@ class CmdQuery : public Command
{
public:
CmdQuery ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,7 +45,7 @@ CmdReports::CmdReports ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdReports::execute (const std::string&, std::string& output)
int CmdReports::execute (std::string& output)
{
std::vector <std::string> reports;

View file

@ -35,7 +35,7 @@ class CmdReports : public Command
{
public:
CmdReports ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -45,7 +45,7 @@ CmdShell::CmdShell ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdShell::execute (const std::string&, std::string&)
int CmdShell::execute (std::string&)
{
// Display some kind of welcome message.
Color bold (Color::nocolor, Color::nocolor, false, true, false);
@ -85,6 +85,7 @@ int CmdShell::execute (const std::string&, std::string&)
{
try
{
/*
context.clear ();
std::vector <std::string> args;
split (args, decoratedCommand, ' ');
@ -94,6 +95,7 @@ int CmdShell::execute (const std::string&, std::string&)
context.initialize (0, NULL);
context.run ();
*/
}
catch (std::string& error)

View file

@ -35,7 +35,7 @@ class CmdShell : public Command
{
public:
CmdShell ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -50,9 +50,10 @@ CmdShow::CmdShow ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdShow::execute (const std::string&, std::string& output)
int CmdShow::execute (std::string& output)
{
int rc = 0;
/*
std::stringstream out;
// Obtain the arguments from the description. That way, things like '--'
@ -308,6 +309,7 @@ int CmdShow::execute (const std::string&, std::string& output)
}
output = out.str ();
*/
return rc;
}

View file

@ -35,7 +35,7 @@ class CmdShow : public Command
{
public:
CmdShow ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -43,7 +43,7 @@ CmdStart::CmdStart ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdStart::execute (const std::string&, std::string& output)
int CmdStart::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdStart : public Command
{
public:
CmdStart ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -49,7 +49,7 @@ CmdStatistics::CmdStatistics ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdStatistics::execute (const std::string&, std::string& output)
int CmdStatistics::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdStatistics : public Command
{
public:
CmdStatistics ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -43,7 +43,7 @@ CmdStop::CmdStop ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdStop::execute (const std::string&, std::string& output)
int CmdStop::execute (std::string& output)
{
int rc = 0;
std::stringstream out;

View file

@ -35,7 +35,7 @@ class CmdStop : public Command
{
public:
CmdStop ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -50,7 +50,7 @@ CmdSummary::CmdSummary ()
// Project Remaining Avg Age Complete 0% 100%
// A 12 13d 55% XXXXXXXXXXXXX-----------
// B 109 3d 12h 10% XXX---------------------
int CmdSummary::execute (const std::string&, std::string& output)
int CmdSummary::execute (std::string& output)
{
int rc = 0;

View file

@ -35,7 +35,7 @@ class CmdSummary : public Command
{
public:
CmdSummary ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -46,7 +46,7 @@ CmdTags::CmdTags ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdTags::execute (const std::string&, std::string& output)
int CmdTags::execute (std::string& output)
{
int rc = 0;
std::stringstream out;
@ -131,7 +131,7 @@ CmdCompletionTags::CmdCompletionTags ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCompletionTags::execute (const std::string&, std::string& output)
int CmdCompletionTags::execute (std::string& output)
{
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));

View file

@ -35,14 +35,14 @@ class CmdTags : public Command
{
public:
CmdTags ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdCompletionTags : public Command
{
public:
CmdCompletionTags ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -46,7 +46,7 @@ CmdTimesheet::CmdTimesheet ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdTimesheet::execute (const std::string&, std::string& output)
int CmdTimesheet::execute (std::string& output)
{
int rc = 0;

View file

@ -35,7 +35,7 @@ class CmdTimesheet : public Command
{
public:
CmdTimesheet ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -42,7 +42,7 @@ CmdTip::CmdTip ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdTip::execute (const std::string&, std::string&)
int CmdTip::execute (std::string&)
{
// TODO Read tips file, pick one, display it.
return 0;

View file

@ -35,7 +35,7 @@ class CmdTip : public Command
{
public:
CmdTip ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -41,7 +41,7 @@ CmdUndo::CmdUndo ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdUndo::execute (const std::string&, std::string& output)
int CmdUndo::execute (std::string& output)
{
context.disallowModification ();

View file

@ -35,7 +35,7 @@ class CmdUndo : public Command
{
public:
CmdUndo ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -44,7 +44,7 @@ CmdUrgency::CmdUrgency ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdUrgency::execute (const std::string&, std::string& output)
int CmdUrgency::execute (std::string& output)
{
// Get all the tasks.
std::vector <Task> tasks;

View file

@ -35,7 +35,7 @@ class CmdUrgency : public Command
{
public:
CmdUrgency ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -46,7 +46,7 @@ CmdVersion::CmdVersion ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdVersion::execute (const std::string&, std::string& output)
int CmdVersion::execute (std::string& output)
{
std::stringstream out;
@ -128,9 +128,7 @@ CmdCompletionVersion::CmdCompletionVersion ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdCompletionVersion::execute (
const std::string&,
std::string& output)
int CmdCompletionVersion::execute (std::string& output)
{
#ifdef HAVE_COMMIT
output = COMMIT;

View file

@ -35,14 +35,14 @@ class CmdVersion : public Command
{
public:
CmdVersion ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
class CmdCompletionVersion : public Command
{
public:
CmdCompletionVersion ();
int execute (const std::string&, std::string&);
int execute (std::string&);
};
#endif

View file

@ -47,7 +47,7 @@ public:
std::string description () const;
bool read_only () const;
bool displays_id () const;
virtual int execute (const std::string&, std::string&) = 0;
virtual int execute (std::string&) = 0;
protected:
std::string _keyword;