mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
A3t
- Renamed methods for consistency.
This commit is contained in:
parent
26fb3c1686
commit
b690a8d2a3
5 changed files with 22 additions and 22 deletions
16
src/A3t.cpp
16
src/A3t.cpp
|
@ -81,7 +81,7 @@ void A3t::initialize (int argc, const char** argv)
|
||||||
//
|
//
|
||||||
// echo one two -- three | task zero --> task zero one two
|
// echo one two -- three | task zero --> task zero one two
|
||||||
// 'three' is left in the input buffer.
|
// 'three' is left in the input buffer.
|
||||||
void A3t::append_stdin ()
|
void A3t::appendStdin ()
|
||||||
{
|
{
|
||||||
#ifdef FEATURE_STDIN
|
#ifdef FEATURE_STDIN
|
||||||
// Use 'select' to determine whether there is any std::cin content buffered
|
// Use 'select' to determine whether there is any std::cin content buffered
|
||||||
|
@ -333,7 +333,7 @@ void A3t::findOverrides ()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Look for RC and return file as a File.
|
// Look for RC and return file as a File.
|
||||||
void A3t::get_overrides (
|
void A3t::getOverrides (
|
||||||
std::string& home,
|
std::string& home,
|
||||||
File& rc)
|
File& rc)
|
||||||
{
|
{
|
||||||
|
@ -361,7 +361,7 @@ void A3t::get_overrides (
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Look for CONFIG data.location and return value as a Path.
|
// Look for CONFIG data.location and return value as a Path.
|
||||||
void A3t::get_data_location (Path& data)
|
void A3t::getDataLocation (Path& data)
|
||||||
{
|
{
|
||||||
std::string location = context.config.get ("data.location");
|
std::string location = context.config.get ("data.location");
|
||||||
if (location != "")
|
if (location != "")
|
||||||
|
@ -385,7 +385,7 @@ void A3t::get_data_location (Path& data)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Takes all CONFIG name/value pairs and overrides configuration.
|
// Takes all CONFIG name/value pairs and overrides configuration.
|
||||||
// leaving only the plain args.
|
// leaving only the plain args.
|
||||||
void A3t::apply_overrides ()
|
void A3t::applyOverrides ()
|
||||||
{
|
{
|
||||||
std::vector <Tree*>::iterator i;
|
std::vector <Tree*>::iterator i;
|
||||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
||||||
|
@ -401,7 +401,7 @@ void A3t::apply_overrides ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void A3t::inject_defaults ()
|
void A3t::injectDefaults ()
|
||||||
{
|
{
|
||||||
//std::cout << "#####################\n";
|
//std::cout << "#####################\n";
|
||||||
//std::cout << _tree->dump ();
|
//std::cout << _tree->dump ();
|
||||||
|
@ -444,7 +444,7 @@ void A3t::inject_defaults ()
|
||||||
{
|
{
|
||||||
//std::cout << "# default_command\n";
|
//std::cout << "# default_command\n";
|
||||||
context.debug ("No command or sequence found - assuming default.command.");
|
context.debug ("No command or sequence found - assuming default.command.");
|
||||||
Tree* t = capture_first (defaultCommand);
|
Tree* t = captureFirst (defaultCommand);
|
||||||
t->tag ("DEFAULT");
|
t->tag ("DEFAULT");
|
||||||
|
|
||||||
std::string combined;
|
std::string combined;
|
||||||
|
@ -477,7 +477,7 @@ void A3t::inject_defaults ()
|
||||||
|
|
||||||
context.debug ("Sequence but no command found - assuming 'information' command.");
|
context.debug ("Sequence but no command found - assuming 'information' command.");
|
||||||
context.header (STRING_ASSUME_INFO);
|
context.header (STRING_ASSUME_INFO);
|
||||||
Tree* t = capture_first ("information");
|
Tree* t = captureFirst ("information");
|
||||||
t->tag ("ASSUMED");
|
t->tag ("ASSUMED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ void A3t::inject_defaults ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Tree* A3t::capture_first (const std::string& arg)
|
Tree* A3t::captureFirst (const std::string& arg)
|
||||||
{
|
{
|
||||||
// Insert the arg as the new first branch.
|
// Insert the arg as the new first branch.
|
||||||
Tree* t = new Tree ("argIns");
|
Tree* t = new Tree ("argIns");
|
||||||
|
|
12
src/A3t.h
12
src/A3t.h
|
@ -38,7 +38,7 @@ public:
|
||||||
A3t ();
|
A3t ();
|
||||||
~A3t ();
|
~A3t ();
|
||||||
void initialize (int, const char**);
|
void initialize (int, const char**);
|
||||||
void append_stdin ();
|
void appendStdin ();
|
||||||
Tree* tree ();
|
Tree* tree ();
|
||||||
Tree* parse ();
|
Tree* parse ();
|
||||||
void entity (const std::string&, const std::string&);
|
void entity (const std::string&, const std::string&);
|
||||||
|
@ -50,11 +50,11 @@ public:
|
||||||
void findIdSequence ();
|
void findIdSequence ();
|
||||||
void findUUIDList ();
|
void findUUIDList ();
|
||||||
|
|
||||||
void get_overrides (std::string&, File&);
|
void getOverrides (std::string&, File&);
|
||||||
void get_data_location (Path&);
|
void getDataLocation (Path&);
|
||||||
void apply_overrides ();
|
void applyOverrides ();
|
||||||
void inject_defaults ();
|
void injectDefaults ();
|
||||||
Tree* capture_first (const std::string&);
|
Tree* captureFirst (const std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void findTerminator ();
|
void findTerminator ();
|
||||||
|
|
|
@ -109,13 +109,13 @@ int Context::initialize (int argc, const char** argv)
|
||||||
// echo one two -- three | task zero --> task zero one two
|
// echo one two -- three | task zero --> task zero one two
|
||||||
// 'three' is left in the input buffer.
|
// 'three' is left in the input buffer.
|
||||||
a3.append_stdin ();
|
a3.append_stdin ();
|
||||||
a3t.append_stdin (); // echo stdin0 | task ...
|
a3t.appendStdin (); // echo stdin0 | task ...
|
||||||
|
|
||||||
// Process 'rc:<file>' command line override, and remove the argument from the
|
// Process 'rc:<file>' command line override, and remove the argument from the
|
||||||
// Context::a3.
|
// Context::a3.
|
||||||
a3.categorize ();
|
a3.categorize ();
|
||||||
a3t.findOverrides (); // rc:<file> rc.<name>:<value>
|
a3t.findOverrides (); // rc:<file> rc.<name>:<value>
|
||||||
a3t.get_overrides (home_dir, rc_file); // <-- <file>
|
a3t.getOverrides (home_dir, rc_file); // <-- <file>
|
||||||
|
|
||||||
// TASKRC environment variable overrides the command line.
|
// TASKRC environment variable overrides the command line.
|
||||||
char* override = getenv ("TASKRC");
|
char* override = getenv ("TASKRC");
|
||||||
|
@ -132,7 +132,7 @@ int Context::initialize (int argc, const char** argv)
|
||||||
// The data location, Context::data_dir, is determined from the assumed
|
// The data location, Context::data_dir, is determined from the assumed
|
||||||
// location (~/.task), or set by data.location in the config file, or
|
// location (~/.task), or set by data.location in the config file, or
|
||||||
// overridden by rc.data.location on the command line.
|
// overridden by rc.data.location on the command line.
|
||||||
a3t.get_data_location (data_dir); // <-- rc.data.location=<location>
|
a3t.getDataLocation (data_dir); // <-- rc.data.location=<location>
|
||||||
|
|
||||||
override = getenv ("TASKDATA");
|
override = getenv ("TASKDATA");
|
||||||
if (override)
|
if (override)
|
||||||
|
@ -144,7 +144,7 @@ int Context::initialize (int argc, const char** argv)
|
||||||
|
|
||||||
// Create missing config file and data directory, if necessary.
|
// Create missing config file and data directory, if necessary.
|
||||||
a3.apply_overrides ();
|
a3.apply_overrides ();
|
||||||
a3t.apply_overrides ();
|
a3t.applyOverrides ();
|
||||||
createDefaultConfig ();
|
createDefaultConfig ();
|
||||||
|
|
||||||
// Handle Aliases.
|
// Handle Aliases.
|
||||||
|
@ -199,7 +199,7 @@ int Context::initialize (int argc, const char** argv)
|
||||||
a3t.findCommand (); // <cmd>
|
a3t.findCommand (); // <cmd>
|
||||||
a3t.findUUIDList (); // <uuid> Before findIdSequence
|
a3t.findUUIDList (); // <uuid> Before findIdSequence
|
||||||
a3t.findIdSequence (); // <id>
|
a3t.findIdSequence (); // <id>
|
||||||
a3t.inject_defaults (); // rc.default.command
|
a3t.injectDefaults (); // rc.default.command
|
||||||
|
|
||||||
// Static initialization to decouple code.
|
// Static initialization to decouple code.
|
||||||
staticInitialization ();
|
staticInitialization ();
|
||||||
|
|
|
@ -37,7 +37,7 @@ int main (int argc, const char** argv)
|
||||||
{
|
{
|
||||||
A3t a3t;
|
A3t a3t;
|
||||||
a3t.initialize (argc, argv);
|
a3t.initialize (argc, argv);
|
||||||
a3t.append_stdin ();
|
a3t.appendStdin ();
|
||||||
a3t.findOverrides ();
|
a3t.findOverrides ();
|
||||||
|
|
||||||
Alias alias;
|
Alias alias;
|
||||||
|
@ -150,7 +150,7 @@ int main (int argc, const char** argv)
|
||||||
a3t.findCommand ();
|
a3t.findCommand ();
|
||||||
a3t.findUUIDList ();
|
a3t.findUUIDList ();
|
||||||
a3t.findIdSequence ();
|
a3t.findIdSequence ();
|
||||||
a3t.inject_defaults ();
|
a3t.injectDefaults ();
|
||||||
|
|
||||||
Tree* tree = a3t.parse ();
|
Tree* tree = a3t.parse ();
|
||||||
if (tree)
|
if (tree)
|
||||||
|
|
|
@ -89,7 +89,7 @@ int CmdCustom::execute (std::string& output)
|
||||||
{
|
{
|
||||||
context.a3.capture_first (*arg);
|
context.a3.capture_first (*arg);
|
||||||
|
|
||||||
Tree* t = context.a3t.capture_first (*arg);
|
Tree* t = context.a3t.captureFirst (*arg);
|
||||||
t->tag ("CUSTOM");
|
t->tag ("CUSTOM");
|
||||||
t->tag ("FILTER");
|
t->tag ("FILTER");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue