mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI2: Simplified all parsing by removing terminator considerations
This commit is contained in:
parent
2cab600674
commit
0aff903024
1 changed files with 10 additions and 25 deletions
35
src/CLI2.cpp
35
src/CLI2.cpp
|
@ -872,32 +872,23 @@ void CLI2::aliasExpansion ()
|
|||
action = false;
|
||||
std::vector <A2> reconstructed;
|
||||
|
||||
bool terminated = false;
|
||||
std::string raw;
|
||||
for (auto& i : _args)
|
||||
{
|
||||
raw = i.attribute ("raw");
|
||||
if (i._lextype == Lexer::Type::separator)
|
||||
terminated = true;
|
||||
|
||||
if (! terminated)
|
||||
if (_aliases.find (raw) != _aliases.end ())
|
||||
{
|
||||
if (_aliases.find (raw) != _aliases.end ())
|
||||
auto lexed = Lexer::split (_aliases[raw]);
|
||||
for (auto& l : lexed)
|
||||
{
|
||||
auto lexed = Lexer::split (_aliases[raw]);
|
||||
for (auto& l : lexed)
|
||||
{
|
||||
A2 a ("argLex", l, Lexer::Type::word);
|
||||
a.tag ("ALIAS");
|
||||
a.tag ("LEX");
|
||||
reconstructed.push_back (a);
|
||||
}
|
||||
|
||||
action = true;
|
||||
changes = true;
|
||||
A2 a ("argLex", l, Lexer::Type::word);
|
||||
a.tag ("ALIAS");
|
||||
a.tag ("LEX");
|
||||
reconstructed.push_back (a);
|
||||
}
|
||||
else
|
||||
reconstructed.push_back (i);
|
||||
|
||||
action = true;
|
||||
changes = true;
|
||||
}
|
||||
else
|
||||
reconstructed.push_back (i);
|
||||
|
@ -923,9 +914,6 @@ void CLI2::findOverrides ()
|
|||
|
||||
for (auto& a : _args)
|
||||
{
|
||||
if (a._lextype == Lexer::Type::separator)
|
||||
break;
|
||||
|
||||
raw = a.attribute ("raw");
|
||||
if (raw.length () > 3 &&
|
||||
raw.find ("rc:") == 0)
|
||||
|
@ -960,9 +948,6 @@ void CLI2::findCommand ()
|
|||
{
|
||||
for (auto& a : _args)
|
||||
{
|
||||
if (a._lextype == Lexer::Type::separator)
|
||||
break;
|
||||
|
||||
std::string canonical;
|
||||
if (canonicalize (canonical, "cmd", a.attribute ("raw")))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue