mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
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:
parent
c2e1757fb6
commit
644d027a87
99 changed files with 397 additions and 289 deletions
|
@ -26,10 +26,13 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
#include <sys/select.h>
|
||||
#include <Context.h>
|
||||
#include <Nibbler.h>
|
||||
#include <ViewText.h>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
#include <Arguments.h>
|
||||
|
@ -47,17 +50,29 @@ Arguments::~Arguments ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Add a pair for every argument, with a category of "".
|
||||
void Arguments::capture (int argc, const char** argv)
|
||||
{
|
||||
for (int i = 0; i < argc; ++i)
|
||||
if (i > 0)
|
||||
this->push_back (argv[i]);
|
||||
this->push_back (std::make_pair (argv[i], (i == 0 ? "program" : "")));
|
||||
|
||||
categorize ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Add a pair with a category of "".
|
||||
void Arguments::capture (const std::string& arg)
|
||||
{
|
||||
this->push_back (std::make_pair (arg, ""));
|
||||
categorize ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Add a pair for every word from std::cin, with a category of "".
|
||||
void Arguments::append_stdin ()
|
||||
{
|
||||
// Capture any stdin args.
|
||||
// Use 'select' to determine whether there is any std::cin content buffered
|
||||
// before trying to read it, to prevent blocking.
|
||||
struct timeval tv;
|
||||
fd_set fds;
|
||||
tv.tv_sec = 0;
|
||||
|
@ -70,12 +85,94 @@ void Arguments::append_stdin ()
|
|||
std::string arg;
|
||||
while (std::cin >> arg)
|
||||
{
|
||||
// It the terminator token is found, stop reading.
|
||||
if (arg == "--")
|
||||
break;
|
||||
|
||||
this->push_back (arg);
|
||||
this->push_back (std::make_pair (arg, ""));
|
||||
}
|
||||
}
|
||||
|
||||
categorize ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Scan all the arguments, and assign a category.
|
||||
void Arguments::categorize ()
|
||||
{
|
||||
bool terminated = false;
|
||||
|
||||
// Generate a vector of command keywords against which autoComplete can run.
|
||||
std::vector <std::string> keywords;
|
||||
std::map <std::string, Command*>::iterator k;
|
||||
for (k = context.commands.begin (); k != context.commands.end (); ++k)
|
||||
keywords.push_back (k->first);
|
||||
|
||||
// First scan for a command.
|
||||
std::vector <std::pair <std::string, std::string> >::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
if (arg->first == "--")
|
||||
break;
|
||||
|
||||
std::vector <std::string> matches;
|
||||
if (autoComplete (arg->first, keywords, matches) == 1)
|
||||
{
|
||||
if (arg->first != matches[0])
|
||||
context.debug ("Arguments::categorize keyword '" + arg->first + "' --> '" + matches[0] + "'");
|
||||
else
|
||||
context.debug ("Arguments::categorize keyword '" + arg->first + "'");
|
||||
|
||||
// Not only categorize the command, but overwrite the original command
|
||||
// the fule name.
|
||||
arg->first = matches[0];
|
||||
arg->second = "command";
|
||||
|
||||
// Only the first match is a command.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Now categorize every uncategorized argument.
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
if (!terminated)
|
||||
{
|
||||
// Nothing after -- is to be interpreted in any way.
|
||||
if (arg->first == "--")
|
||||
{
|
||||
terminated = true;
|
||||
arg->second = "terminator";
|
||||
}
|
||||
|
||||
// // Only categorize uncategorized args.
|
||||
// else if (arg->second == "")
|
||||
else
|
||||
{
|
||||
// rc:<file>
|
||||
if (arg->first.substr (0, 3) == "rc:")
|
||||
arg->second = "rc";
|
||||
|
||||
// rc.<name>[:=]<value>
|
||||
else if (arg->first.substr (0, 3) == "rc.")
|
||||
arg->second = "override";
|
||||
|
||||
// TODO Sequence
|
||||
// TODO UUID
|
||||
// TODO +tag
|
||||
// TODO -tag
|
||||
// TODO subst
|
||||
// TODO attr
|
||||
|
||||
else if (arg->second == "")
|
||||
arg->second = "word";
|
||||
}
|
||||
}
|
||||
|
||||
// All post-termination arguments are simply words.
|
||||
else
|
||||
arg->second = "word";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -85,17 +182,13 @@ void Arguments::rc_override (
|
|||
std::string& override)
|
||||
{
|
||||
// Is there an override for rc:<file>?
|
||||
std::vector <std::string>::iterator arg;
|
||||
std::vector <std::pair <std::string, std::string> >::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
// Nothing after -- is to be interpreted in any way.
|
||||
if (*arg == "--")
|
||||
break;
|
||||
|
||||
else if (arg->substr (0, 3) == "rc:")
|
||||
if (arg->second == "rc")
|
||||
{
|
||||
override = *arg;
|
||||
rc = File (arg->substr (3));
|
||||
override = arg->first;
|
||||
rc = File (arg->first.substr (3));
|
||||
home = rc;
|
||||
|
||||
std::string::size_type last_slash = rc.data.rfind ("/");
|
||||
|
@ -104,9 +197,10 @@ void Arguments::rc_override (
|
|||
else
|
||||
home = ".";
|
||||
|
||||
this->erase (arg);
|
||||
context.header ("Using alternate .taskrc file " + rc.data); // TODO i18n
|
||||
break; // Must break - iterator is dead.
|
||||
|
||||
// Keep scanning, because if there are multiple rc:file arguments, we
|
||||
// want the last one to dominate.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,17 +213,21 @@ void Arguments::get_data_location (std::string& data)
|
|||
data = location;
|
||||
|
||||
// Are there any overrides for data.location?
|
||||
std::vector <std::string>::iterator arg;
|
||||
std::vector <std::pair <std::string, std::string> >::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
if (*arg == "--")
|
||||
break;
|
||||
else if (arg->substr (0, 16) == "rc.data.location" &&
|
||||
((*arg)[16] == ':' || (*arg)[16] == '='))
|
||||
if (arg->second == "override")
|
||||
{
|
||||
data = arg->substr (17);
|
||||
context.header ("Using alternate data.location " + data); // TODO i18n
|
||||
if (arg->first.substr (0, 16) == "rc.data.location" &&
|
||||
(arg->first[16] == ':' || arg->first[16] == '='))
|
||||
{
|
||||
data = arg->first.substr (17);
|
||||
context.header ("Using alternate data.location " + data); // TODO i18n
|
||||
}
|
||||
}
|
||||
|
||||
// Keep scanning, because if there are multiple rc:file arguments, we
|
||||
// want the last one to dominate.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,22 +236,14 @@ void Arguments::get_data_location (std::string& data)
|
|||
// leaving only the plain args.
|
||||
void Arguments::apply_overrides (std::string& var_overrides)
|
||||
{
|
||||
std::vector <std::string> filtered;
|
||||
bool foundTerminator = false;
|
||||
|
||||
std::vector <std::string>::iterator arg;
|
||||
std::vector <std::pair <std::string, std::string> >::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
if (*arg == "--")
|
||||
{
|
||||
foundTerminator = true;
|
||||
filtered.push_back (*arg);
|
||||
}
|
||||
else if (!foundTerminator && arg->substr (0, 3) == "rc.")
|
||||
if (arg->second == "override")
|
||||
{
|
||||
std::string name;
|
||||
std::string value;
|
||||
Nibbler n (*arg);
|
||||
Nibbler n (arg->first);
|
||||
if (n.getLiteral ("rc.") && // rc.
|
||||
n.getUntilOneOf (":=", name) && // xxx
|
||||
n.skipN (1)) // :
|
||||
|
@ -161,22 +251,15 @@ void Arguments::apply_overrides (std::string& var_overrides)
|
|||
n.getUntilEOS (value); // Don't care if it's blank.
|
||||
|
||||
context.config.set (name, value);
|
||||
context.footnote ("Configuration override " + arg->substr (3));
|
||||
context.footnote ("Configuration override rc." + name + "=" + value);
|
||||
|
||||
// Overrides are retained for potential use by the default command.
|
||||
var_overrides += " " + *arg;
|
||||
var_overrides += " " + arg->first;
|
||||
}
|
||||
else
|
||||
context.footnote ("Problem with override: " + *arg);
|
||||
context.footnote ("Problem with override: " + arg->first);
|
||||
}
|
||||
else
|
||||
filtered.push_back (*arg);
|
||||
}
|
||||
|
||||
// Overwrite args with the filtered subset.
|
||||
this->clear ();
|
||||
for (arg = filtered.begin (); arg != filtered.end (); ++arg)
|
||||
this->push_back (*arg);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -187,22 +270,22 @@ void Arguments::resolve_aliases ()
|
|||
std::vector <std::string> expanded;
|
||||
bool something = false;
|
||||
|
||||
std::vector <std::string>::iterator arg;
|
||||
std::vector <std::pair <std::string, std::string> >::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
std::map <std::string, std::string>::iterator match =
|
||||
context.aliases.find (*arg);
|
||||
context.aliases.find (arg->first);
|
||||
|
||||
if (match != context.aliases.end ())
|
||||
{
|
||||
context.debug (std::string ("Arguments::resolve_aliases '")
|
||||
+ *arg
|
||||
+ arg->first
|
||||
+ "' --> '"
|
||||
+ context.aliases[*arg]
|
||||
+ context.aliases[arg->first]
|
||||
+ "'");
|
||||
|
||||
std::vector <std::string> words;
|
||||
splitq (words, context.aliases[*arg], ' ');
|
||||
splitq (words, context.aliases[arg->first], ' ');
|
||||
|
||||
std::vector <std::string>::iterator word;
|
||||
for (word = words.begin (); word != words.end (); ++word)
|
||||
|
@ -211,45 +294,59 @@ void Arguments::resolve_aliases ()
|
|||
something = true;
|
||||
}
|
||||
else
|
||||
expanded.push_back (*arg);
|
||||
expanded.push_back (arg->first);
|
||||
}
|
||||
|
||||
// Only overwrite if something happened.
|
||||
if (something)
|
||||
{
|
||||
this->clear ();
|
||||
for (arg = expanded.begin (); arg != expanded.end (); ++arg)
|
||||
this->push_back (*arg);
|
||||
std::vector <std::string>::iterator e;
|
||||
for (e = expanded.begin (); e != expanded.end (); ++e)
|
||||
this->push_back (std::make_pair (*e, ""));
|
||||
|
||||
// Must now re-categorize everything.
|
||||
categorize ();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::vector <std::string> Arguments::list ()
|
||||
{
|
||||
std::vector <std::string> all;
|
||||
std::vector <std::pair <std::string, std::string> >::iterator i;
|
||||
for (i = this->begin (); i != this->end (); ++i)
|
||||
all.push_back (i->first);
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Arguments::combine ()
|
||||
{
|
||||
std::string combined;
|
||||
join (combined, " ", *(std::vector <std::string>*)this);
|
||||
|
||||
std::vector <std::pair <std::string, std::string> >::iterator i;
|
||||
for (i = this->begin (); i != this->end (); ++i)
|
||||
{
|
||||
if (i != this->begin ())
|
||||
combined += " ";
|
||||
|
||||
combined += i->first;
|
||||
}
|
||||
|
||||
return combined;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Given a vector of command keywords, scan all arguments and locate the first
|
||||
// argument that matches a keyword.
|
||||
bool Arguments::extract_command (
|
||||
const std::vector <std::string>& keywords,
|
||||
std::string& command)
|
||||
bool Arguments::find_command (std::string& command)
|
||||
{
|
||||
std::vector <std::string>::iterator arg;
|
||||
std::vector <std::pair <std::string, std::string> >::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
std::vector <std::string> matches;
|
||||
if (autoComplete (*arg, keywords, matches) == 1)
|
||||
if (arg->second == "command")
|
||||
{
|
||||
if (*arg != matches[0])
|
||||
context.debug ("Arguments::extract_command keyword '" + *arg + "' --> '" + matches[0] + "'");
|
||||
else
|
||||
context.debug ("Arguments::extract_command keyword '" + *arg + "'");
|
||||
|
||||
command = matches[0];
|
||||
command = arg->first;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -257,24 +354,6 @@ bool Arguments::extract_command (
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::remove_command (const std::string& command)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_filter ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_modifications ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// A sequence can be:
|
||||
//
|
||||
|
@ -300,6 +379,7 @@ void Arguments::extract_modifications ()
|
|||
//
|
||||
void Arguments::extract_sequence (std::vector <int>& sequence)
|
||||
{
|
||||
/*
|
||||
sequence.clear ();
|
||||
std::vector <int> kill;
|
||||
|
||||
|
@ -378,44 +458,52 @@ void Arguments::extract_sequence (std::vector <int>& sequence)
|
|||
// Now remove args in the kill list.
|
||||
for (unsigned int k = 0; k < kill.size (); ++k)
|
||||
this->erase (this->begin () + kill[k]);
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_uuids (std::vector <std::string>& uuids)
|
||||
void Arguments::dump (const std::string& label)
|
||||
{
|
||||
uuids.clear ();
|
||||
// Set up a map of categories to colors.
|
||||
std::map <std::string, Color> color_map;
|
||||
color_map["program"] = Color ("white on blue");
|
||||
color_map["command"] = Color ("black on cyan");
|
||||
color_map["rc"] = Color ("bold white on red");
|
||||
color_map["override"] = Color ("white on red");
|
||||
color_map["none"] = Color ("white on gray3");
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_attrs ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_words ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_tags ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_pattern ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO
|
||||
void Arguments::extract_subst ()
|
||||
{
|
||||
Color color_debug (context.config.get ("color.debug"));
|
||||
std::stringstream out;
|
||||
out << color_debug.colorize (label)
|
||||
<< "\n";
|
||||
|
||||
ViewText view;
|
||||
view.width (context.getWidth ());
|
||||
view.leftMargin (4);
|
||||
for (unsigned int i = 0; i < this->size (); ++i)
|
||||
view.add (Column::factory ("string", ""));
|
||||
|
||||
view.addRow ();
|
||||
view.addRow ();
|
||||
|
||||
for (unsigned int i = 0; i < this->size (); ++i)
|
||||
{
|
||||
std::string arg = (*this)[i].first;
|
||||
std::string category = (*this)[i].second;
|
||||
|
||||
Color c;
|
||||
if (color_map[category].nontrivial ())
|
||||
c = color_map[category];
|
||||
else
|
||||
c = color_map["none"];
|
||||
|
||||
view.set (0, i, arg, c);
|
||||
view.set (1, i, category, c);
|
||||
}
|
||||
|
||||
out << view.render ();
|
||||
context.debug (out.str ());
|
||||
std::cout << out.str (); // TODO Remove
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -34,38 +34,40 @@
|
|||
|
||||
#define ARGUMENTS_SEQUENCE_MAX_RANGE 1000
|
||||
|
||||
class Arguments : public std::vector <std::string>
|
||||
class Arguments : public std::vector <std::pair <std::string, std::string> >
|
||||
{
|
||||
public:
|
||||
Arguments ();
|
||||
~Arguments ();
|
||||
|
||||
void capture (int, const char**);
|
||||
void capture (const std::string&);
|
||||
void categorize ();
|
||||
|
||||
void append_stdin ();
|
||||
void rc_override (std::string&, File&, std::string&);
|
||||
void get_data_location (std::string&);
|
||||
void apply_overrides (std::string&);
|
||||
void resolve_aliases ();
|
||||
|
||||
std::vector <std::string> list ();
|
||||
std::string combine ();
|
||||
|
||||
bool extract_command (const std::vector <std::string>&, std::string&);
|
||||
void remove_command (const std::string&);
|
||||
|
||||
bool find_command (std::string&);
|
||||
/*
|
||||
void extract_read_only (command, filter);
|
||||
void extract_write_commands (filter, command, mods);
|
||||
*/
|
||||
|
||||
void extract_filter ();
|
||||
void extract_modifications ();
|
||||
|
||||
*/
|
||||
void extract_sequence (std::vector <int>&);
|
||||
/*
|
||||
void extract_uuids (std::vector <std::string>&);
|
||||
void extract_attrs ();
|
||||
void extract_words ();
|
||||
void extract_tags ();
|
||||
void extract_pattern ();
|
||||
void extract_subst ();
|
||||
*/
|
||||
void dump (const std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
#include <Directory.h>
|
||||
#include <Date.h>
|
||||
#include <File.h>
|
||||
#include <Timer.h>
|
||||
#include <Config.h>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
#include <cmake.h>
|
||||
#include <i18n.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This string is used in two ways:
|
||||
|
@ -473,9 +475,10 @@ Config::Config (const std::string& file)
|
|||
//
|
||||
void Config::load (const std::string& file, int nest /* = 1 */)
|
||||
{
|
||||
Timer timer ("Config::load (" + file + ")");
|
||||
|
||||
if (nest > 10)
|
||||
throw std::string ("Configuration file nested to more than 10 levels deep"
|
||||
" - this has to be a mistake.");
|
||||
throw std::string (STRING_CONFIG_OVERNEST);
|
||||
|
||||
// First time in, load the default values.
|
||||
if (nest == 1)
|
||||
|
|
|
@ -44,8 +44,7 @@
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Context::Context ()
|
||||
: program ("")
|
||||
, rc_file ()
|
||||
: rc_file ()
|
||||
, data_dir ()
|
||||
, extension_dir ()
|
||||
, config ()
|
||||
|
@ -55,7 +54,6 @@ Context::Context ()
|
|||
, task ()
|
||||
, tdb ()
|
||||
, tdb2 ()
|
||||
, commandLine ("")
|
||||
, file_override ("")
|
||||
, var_overrides ("")
|
||||
, dom ()
|
||||
|
@ -63,7 +61,6 @@ Context::Context ()
|
|||
, use_color (true)
|
||||
, verbosity_legacy (false)
|
||||
, inShadow (false)
|
||||
, command ("")
|
||||
, terminal_width (0)
|
||||
, terminal_height (0)
|
||||
{
|
||||
|
@ -81,7 +78,6 @@ void Context::initialize (int argc, const char** argv)
|
|||
|
||||
// char** argv --> std::vector <std::string> Context::args.
|
||||
// TODO Handle "cal" case here.
|
||||
program = argv[0];
|
||||
args.capture (argc, argv);
|
||||
|
||||
// echo one two -- three | task zero --> task zero one two
|
||||
|
@ -117,9 +113,6 @@ void Context::initialize (int argc, const char** argv)
|
|||
// Apply rc overrides to Context::config, capturing raw args for later use.
|
||||
args.apply_overrides (var_overrides);
|
||||
|
||||
// Combine command line into one string.
|
||||
commandLine = args.combine ();
|
||||
|
||||
// Initialize the color rules, if necessary.
|
||||
if (color ())
|
||||
initializeColorRules ();
|
||||
|
@ -130,14 +123,6 @@ void Context::initialize (int argc, const char** argv)
|
|||
// TODO Instantiate extension command objects.
|
||||
// TODO Instantiate default command object.
|
||||
|
||||
// Create list of all command keywords.
|
||||
std::vector <std::string> keywords;
|
||||
std::map <std::string, Command*>::iterator i;
|
||||
for (i = commands.begin (); i != commands.end (); ++i)
|
||||
keywords.push_back (i->first);
|
||||
|
||||
args.extract_command (keywords, command);
|
||||
|
||||
// TODO Instantiate extension UDA objects.
|
||||
// TODO Instantiate extension format objects.
|
||||
|
||||
|
@ -160,6 +145,8 @@ void Context::initialize (int argc, const char** argv)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Context::run ()
|
||||
{
|
||||
Timer timer ("Context::run");
|
||||
|
||||
int rc;
|
||||
std::string output;
|
||||
try
|
||||
|
@ -181,12 +168,16 @@ int Context::run ()
|
|||
|
||||
// Dump all debug messages, controlled by rc.debug.
|
||||
if (config.getBoolean ("debug"))
|
||||
{
|
||||
foreach (d, debugMessages)
|
||||
if (color ())
|
||||
std::cout << colorizeDebug (*d) << "\n";
|
||||
else
|
||||
std::cout << *d << "\n";
|
||||
|
||||
args.dump ("Argument categorization");
|
||||
}
|
||||
|
||||
// Dump all headers, controlled by 'header' verbosity token.
|
||||
if (verbose ("header"))
|
||||
foreach (h, headers)
|
||||
|
@ -218,7 +209,8 @@ int Context::dispatch (std::string &out)
|
|||
Timer t ("Context::dispatch");
|
||||
|
||||
// Autocomplete args against keywords.
|
||||
if (command != "")
|
||||
std::string command;
|
||||
if (args.find_command (command))
|
||||
{
|
||||
updateXtermTitle ();
|
||||
|
||||
|
@ -228,13 +220,13 @@ int Context::dispatch (std::string &out)
|
|||
if (c->displays_id ())
|
||||
tdb.gc ();
|
||||
|
||||
return c->execute (commandLine, out);
|
||||
return c->execute (out);
|
||||
}
|
||||
|
||||
// TODO Need to invoke 'information' when a sequence/filter is present, but
|
||||
// no command is specified.
|
||||
|
||||
return commands["help"]->execute (commandLine, out);
|
||||
return commands["help"]->execute (out);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -265,6 +257,8 @@ bool Context::color ()
|
|||
|
||||
// No need to go through this again.
|
||||
determine_color_use = false;
|
||||
|
||||
debug ("Context::color --> " + std::string (use_color ? "on" : "off"));
|
||||
}
|
||||
|
||||
// Cached result.
|
||||
|
@ -294,6 +288,7 @@ bool Context::verbose (const std::string& token)
|
|||
// TODO OBSOLETE
|
||||
void Context::shadow ()
|
||||
{
|
||||
/*
|
||||
// Determine if shadow file is enabled.
|
||||
File shadowFile (config.get ("shadow.file"));
|
||||
if (shadowFile.data != "")
|
||||
|
@ -352,6 +347,7 @@ void Context::shadow ()
|
|||
|
||||
inShadow = false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -708,8 +704,6 @@ void Context::clear ()
|
|||
task = Task ();
|
||||
tdb.clear (); // TODO Obsolete
|
||||
// tdb2.clear ();
|
||||
program = "";
|
||||
commandLine = "";
|
||||
args.clear ();
|
||||
file_override = "";
|
||||
var_overrides = "";
|
||||
|
@ -834,8 +828,11 @@ void Context::updateXtermTitle ()
|
|||
{
|
||||
if (config.getBoolean ("xterm.title"))
|
||||
{
|
||||
std::string command;
|
||||
args.find_command (command);
|
||||
|
||||
std::string title;
|
||||
join (title, " ", args);
|
||||
join (title, " ", args.list ());
|
||||
std::cout << "]0;task " << command << " " << title << "" << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ public:
|
|||
Task task; // TODO Obsolete
|
||||
TDB tdb; // TODO Obsolete
|
||||
TDB2 tdb2;
|
||||
std::string commandLine; // TODO Obsolete
|
||||
std::string file_override;
|
||||
std::string var_overrides;
|
||||
std::map <std::string, std::string> aliases;
|
||||
|
@ -123,7 +122,6 @@ public:
|
|||
bool inShadow;
|
||||
|
||||
std::map <std::string, Command*> commands;
|
||||
std::string command;
|
||||
|
||||
int terminal_width;
|
||||
int terminal_height;
|
||||
|
|
|
@ -78,12 +78,12 @@ const std::string DOM::get (const std::string& name)
|
|||
name.substr (0, 8) == "context.")
|
||||
{
|
||||
if (name == "context.program")
|
||||
return context.program;
|
||||
return context.args[0].first;
|
||||
|
||||
else if (name == "context.args")
|
||||
{
|
||||
std::string combined;
|
||||
join (combined, " ", context.args);
|
||||
join (combined, " ", context.args.list ());
|
||||
return combined;
|
||||
}
|
||||
else if (name == "context.width")
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdAdd : public Command
|
|||
{
|
||||
public:
|
||||
CmdAdd ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,7 @@ CmdAnnotate::CmdAnnotate ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdAnnotate::execute (const std::string&, std::string& output)
|
||||
int CmdAnnotate::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdAnnotate : public Command
|
|||
{
|
||||
public:
|
||||
CmdAnnotate ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdAppend : public Command
|
|||
{
|
||||
public:
|
||||
CmdAppend ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdColor : public Command
|
|||
{
|
||||
public:
|
||||
CmdColor ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdCount : public Command
|
|||
{
|
||||
public:
|
||||
CmdCount ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>&);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdDelete : public Command
|
|||
{
|
||||
public:
|
||||
CmdDelete ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,7 @@ CmdDenotate::CmdDenotate ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdDenotate::execute (const std::string&, std::string& output)
|
||||
int CmdDenotate::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdDenotate : public Command
|
|||
{
|
||||
public:
|
||||
CmdDenotate ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdDiagnostics : public Command
|
|||
{
|
||||
public:
|
||||
CmdDiagnostics ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdDone : public Command
|
|||
{
|
||||
public:
|
||||
CmdDone ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdDuplicate : public Command
|
|||
{
|
||||
public:
|
||||
CmdDuplicate ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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&);
|
||||
|
|
|
@ -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 ());
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdExec : public Command
|
|||
{
|
||||
public:
|
||||
CmdExec ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 ());
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdHelp : public Command
|
|||
{
|
||||
public:
|
||||
CmdHelp ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdImport : public Command
|
|||
{
|
||||
public:
|
||||
CmdImport ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
|
||||
private:
|
||||
enum fileType
|
||||
|
|
|
@ -47,7 +47,7 @@ CmdInfo::CmdInfo ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdInfo::execute (const std::string&, std::string& output)
|
||||
int CmdInfo::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdInfo : public Command
|
|||
{
|
||||
public:
|
||||
CmdInfo ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdInstall : public Command
|
|||
{
|
||||
public:
|
||||
CmdInstall ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdLog : public Command
|
|||
{
|
||||
public:
|
||||
CmdLog ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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[] =
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdLogo : public Command
|
|||
{
|
||||
public:
|
||||
CmdLogo ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdMerge : public Command
|
|||
{
|
||||
public:
|
||||
CmdMerge ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdModify : public Command
|
|||
{
|
||||
public:
|
||||
CmdModify ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdPrepend : public Command
|
|||
{
|
||||
public:
|
||||
CmdPrepend ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdPull : public Command
|
|||
{
|
||||
public:
|
||||
CmdPull ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdPush : public Command
|
|||
{
|
||||
public:
|
||||
CmdPush ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@ CmdQuery::CmdQuery ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdQuery::execute (const std::string&, std::string& output)
|
||||
int CmdQuery::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdQuery : public Command
|
|||
{
|
||||
public:
|
||||
CmdQuery ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdReports : public Command
|
|||
{
|
||||
public:
|
||||
CmdReports ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdShell : public Command
|
|||
{
|
||||
public:
|
||||
CmdShell ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdShow : public Command
|
|||
{
|
||||
public:
|
||||
CmdShow ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdStart : public Command
|
|||
{
|
||||
public:
|
||||
CmdStart ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdStatistics : public Command
|
|||
{
|
||||
public:
|
||||
CmdStatistics ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdStop : public Command
|
|||
{
|
||||
public:
|
||||
CmdStop ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdSummary : public Command
|
|||
{
|
||||
public:
|
||||
CmdSummary ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -46,7 +46,7 @@ CmdTimesheet::CmdTimesheet ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdTimesheet::execute (const std::string&, std::string& output)
|
||||
int CmdTimesheet::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdTimesheet : public Command
|
|||
{
|
||||
public:
|
||||
CmdTimesheet ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdTip : public Command
|
|||
{
|
||||
public:
|
||||
CmdTip ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,7 +41,7 @@ CmdUndo::CmdUndo ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdUndo::execute (const std::string&, std::string& output)
|
||||
int CmdUndo::execute (std::string& output)
|
||||
{
|
||||
context.disallowModification ();
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdUndo : public Command
|
|||
{
|
||||
public:
|
||||
CmdUndo ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdUrgency : public Command
|
|||
{
|
||||
public:
|
||||
CmdUrgency ();
|
||||
int execute (const std::string&, std::string&);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -108,6 +108,9 @@
|
|||
#define STRING_CMD_SHOW_CONF_VAR "Config Variable"
|
||||
#define STRING_CMD_SHOW_CONF_VALUE "Value"
|
||||
|
||||
// Config
|
||||
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."
|
||||
|
||||
// Context
|
||||
#define STRING_CONTEXT_CREATE_RC "A configuration file could not be found in {1}\n\nWould you like a sample {2} created, so taskwarrior can proceed?"
|
||||
#define STRING_CONTEXT_NEED_RC "Cannot proceed without rc file."
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
Context context;
|
||||
|
||||
int main (int argc, char** argv)
|
||||
int main (int argc, const char** argv)
|
||||
{
|
||||
// Set up randomness.
|
||||
#ifdef CYGWIN
|
||||
|
@ -63,7 +63,7 @@ int main (int argc, char** argv)
|
|||
|
||||
try
|
||||
{
|
||||
context.initialize (argc, (const char**)argv);
|
||||
context.initialize (argc, argv);
|
||||
status = context.run ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue