mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI2: Entity capture.
- CLI2::entity now captures all the known entities, duplicating the processing in Context for now.
This commit is contained in:
parent
96493db047
commit
22765a70cb
3 changed files with 27 additions and 1 deletions
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <cmake.h>
|
||||
//#include <sstream>
|
||||
//#include <algorithm>
|
||||
#include <algorithm>
|
||||
#include <Context.h>
|
||||
//#include <Nibbler.h>
|
||||
//#include <Lexer.h>
|
||||
|
@ -317,6 +317,7 @@ void CLI2::alias (const std::string& name, const std::string& value)
|
|||
{
|
||||
_aliases.insert (std::pair <std::string, std::string> (name, value));
|
||||
}
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI2::entity (const std::string& category, const std::string& name)
|
||||
|
@ -331,6 +332,7 @@ void CLI2::entity (const std::string& category, const std::string& name)
|
|||
_entities.insert (std::pair <std::string, std::string> (category, name));
|
||||
}
|
||||
|
||||
/*
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Capture the original, intact command line arguments.
|
||||
void CLI2::initialize (int argc, const char** argv)
|
||||
|
|
|
@ -79,7 +79,9 @@ public:
|
|||
~CLI2 ();
|
||||
/*
|
||||
void alias (const std::string&, const std::string&);
|
||||
*/
|
||||
void entity (const std::string&, const std::string&);
|
||||
/*
|
||||
void initialize (int, const char**);
|
||||
void add (const std::string&);
|
||||
void addContextFilter ();
|
||||
|
@ -138,9 +140,11 @@ private:
|
|||
bool disqualifyOnlyParenOps (const std::vector <std::pair <std::string, Lexer::Type>>&) const;
|
||||
bool disqualifyFirstLastBinary (const std::vector <std::pair <std::string, Lexer::Type>>&) const;
|
||||
bool disqualifySugarFree (const std::vector <std::pair <std::string, Lexer::Type>>&) const;
|
||||
*/
|
||||
|
||||
public:
|
||||
std::multimap <std::string, std::string> _entities;
|
||||
/*
|
||||
std::map <std::string, std::string> _aliases;
|
||||
std::vector <std::string> _original_args;
|
||||
std::vector <A> _args;
|
||||
|
|
|
@ -155,6 +155,12 @@ int Context::initialize (int argc, const char** argv)
|
|||
Command::factory (commands);
|
||||
for (auto& cmd : commands)
|
||||
{
|
||||
cli2.entity ("cmd", cmd.first);
|
||||
cli2.entity ((cmd.second->read_only () ? "readcmd" : "writecmd"), cmd.first);
|
||||
|
||||
if (cmd.first[0] == '_')
|
||||
cli2.entity ("helper", cmd.first);
|
||||
|
||||
cli.entity ("cmd", cmd.first);
|
||||
cli.entity ((cmd.second->read_only () ? "readcmd" : "writecmd"), cmd.first);
|
||||
|
||||
|
@ -169,6 +175,11 @@ int Context::initialize (int argc, const char** argv)
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Column::factory (columns);
|
||||
for (auto& col : columns)
|
||||
cli2.entity ("attribute", col.first);
|
||||
|
||||
cli2.entity ("pseudo", "limit");
|
||||
|
||||
for (auto& col : columns)
|
||||
cli.entity ("attribute", col.first);
|
||||
|
||||
|
@ -180,6 +191,15 @@ int Context::initialize (int argc, const char** argv)
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
for (unsigned int i = 0; i < NUM_MODIFIER_NAMES; ++i)
|
||||
cli2.entity ("modifier", modifierNames[i]);
|
||||
|
||||
for (auto& op : Eval::getOperators ())
|
||||
cli2.entity ("operator", op);
|
||||
|
||||
for (auto& op : Eval::getBinaryOperators ())
|
||||
cli2.entity ("binary_operator", op);
|
||||
|
||||
for (unsigned int i = 0; i < NUM_MODIFIER_NAMES; ++i)
|
||||
cli.entity ("modifier", modifierNames[i]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue