mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Context
- Relocated some (more needed) entity declarations into ::setupEntities.
This commit is contained in:
parent
7417737bbe
commit
3700d2df9f
2 changed files with 29 additions and 21 deletions
|
@ -103,6 +103,9 @@ int Context::initialize (int argc, const char** argv)
|
||||||
// Assume default .taskrc and .task locations.
|
// Assume default .taskrc and .task locations.
|
||||||
assumeLocations ();
|
assumeLocations ();
|
||||||
|
|
||||||
|
// The parser needs all the help it can get.
|
||||||
|
setupEntities ();
|
||||||
|
|
||||||
// Initialize the command line parser.
|
// Initialize the command line parser.
|
||||||
program = (argc ? argv[0] : "task");
|
program = (argc ? argv[0] : "task");
|
||||||
|
|
||||||
|
@ -217,27 +220,6 @@ int Context::initialize (int argc, const char** argv)
|
||||||
cli.entity ("attribute", col->first);
|
cli.entity ("attribute", col->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entities: Pseudo-attributes. Hard-coded.
|
|
||||||
parser.entity ("pseudo", "limit");
|
|
||||||
cli.entity ("pseudo", "limit");
|
|
||||||
|
|
||||||
// Entities: Modifiers.
|
|
||||||
for (unsigned int i = 0; i < NUM_MODIFIER_NAMES; ++i)
|
|
||||||
{
|
|
||||||
parser.entity ("modifier", modifierNames[i]);
|
|
||||||
cli.entity ("modifier", modifierNames[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entities: Operators.
|
|
||||||
std::vector <std::string> operators;
|
|
||||||
Eval::getOperators (operators);
|
|
||||||
std::vector <std::string>::iterator op;
|
|
||||||
for (op = operators.begin (); op != operators.end (); ++op)
|
|
||||||
{
|
|
||||||
parser.entity ("operator", *op);
|
|
||||||
cli.entity ("operator", *op);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now the entities are loaded, parsing may resume.
|
// Now the entities are loaded, parsing may resume.
|
||||||
parser.findBinary (); // <task|tw|t|cal|calendar>
|
parser.findBinary (); // <task|tw|t|cal|calendar>
|
||||||
parser.resolveAliases ();
|
parser.resolveAliases ();
|
||||||
|
@ -672,6 +654,31 @@ void Context::assumeLocations ()
|
||||||
data_dir = Directory ("~/.task");
|
data_dir = Directory ("~/.task");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void Context::setupEntities ()
|
||||||
|
{
|
||||||
|
// Entities: Pseudo-attributes. Hard-coded.
|
||||||
|
parser.entity ("pseudo", "limit");
|
||||||
|
cli.entity ("pseudo", "limit");
|
||||||
|
|
||||||
|
// Entities: Modifiers.
|
||||||
|
for (unsigned int i = 0; i < NUM_MODIFIER_NAMES; ++i)
|
||||||
|
{
|
||||||
|
parser.entity ("modifier", modifierNames[i]);
|
||||||
|
cli.entity ("modifier", modifierNames[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entities: Operators.
|
||||||
|
std::vector <std::string> operators;
|
||||||
|
Eval::getOperators (operators);
|
||||||
|
std::vector <std::string>::iterator op;
|
||||||
|
for (op = operators.begin (); op != operators.end (); ++op)
|
||||||
|
{
|
||||||
|
parser.entity ("operator", *op);
|
||||||
|
cli.entity ("operator", *op);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Context::createDefaultConfig ()
|
void Context::createDefaultConfig ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,6 +76,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void staticInitialization ();
|
void staticInitialization ();
|
||||||
void assumeLocations ();
|
void assumeLocations ();
|
||||||
|
void setupEntities ();
|
||||||
void createDefaultConfig ();
|
void createDefaultConfig ();
|
||||||
void updateXtermTitle ();
|
void updateXtermTitle ();
|
||||||
void updateVerbosity ();
|
void updateVerbosity ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue