mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Aliases
- Allowed aliases to nest up to 10 levels.
This commit is contained in:
parent
2d30275889
commit
d5849b0160
1 changed files with 36 additions and 29 deletions
|
@ -566,45 +566,52 @@ void Arguments::apply_overrides ()
|
|||
void Arguments::resolve_aliases ()
|
||||
{
|
||||
std::vector <std::string> expanded;
|
||||
bool something = false;
|
||||
bool something;
|
||||
int safety_valve = 10;
|
||||
|
||||
std::vector <Triple>::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
do
|
||||
{
|
||||
std::map <std::string, std::string>::iterator match =
|
||||
context.aliases.find (arg->_first);
|
||||
|
||||
if (match != context.aliases.end ())
|
||||
something = false;
|
||||
std::vector <Triple>::iterator arg;
|
||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||
{
|
||||
context.debug (std::string ("Arguments::resolve_aliases '")
|
||||
+ arg->_first
|
||||
+ "' --> '"
|
||||
+ context.aliases[arg->_first]
|
||||
+ "'");
|
||||
std::map <std::string, std::string>::iterator match =
|
||||
context.aliases.find (arg->_first);
|
||||
|
||||
std::vector <std::string> words;
|
||||
splitq (words, context.aliases[arg->_first], ' ');
|
||||
if (match != context.aliases.end ())
|
||||
{
|
||||
context.debug (std::string ("Arguments::resolve_aliases '")
|
||||
+ arg->_first
|
||||
+ "' --> '"
|
||||
+ context.aliases[arg->_first]
|
||||
+ "'");
|
||||
|
||||
std::vector <std::string>::iterator word;
|
||||
for (word = words.begin (); word != words.end (); ++word)
|
||||
expanded.push_back (*word);
|
||||
std::vector <std::string> words;
|
||||
splitq (words, context.aliases[arg->_first], ' ');
|
||||
|
||||
something = true;
|
||||
std::vector <std::string>::iterator word;
|
||||
for (word = words.begin (); word != words.end (); ++word)
|
||||
expanded.push_back (*word);
|
||||
|
||||
something = true;
|
||||
}
|
||||
else
|
||||
expanded.push_back (arg->_first);
|
||||
}
|
||||
else
|
||||
expanded.push_back (arg->_first);
|
||||
}
|
||||
|
||||
// Only overwrite if something happened.
|
||||
if (something)
|
||||
{
|
||||
this->clear ();
|
||||
std::vector <std::string>::iterator e;
|
||||
for (e = expanded.begin (); e != expanded.end (); ++e)
|
||||
this->push_back (Triple (*e, "", ""));
|
||||
// Only overwrite if something happened.
|
||||
if (something)
|
||||
{
|
||||
this->clear ();
|
||||
std::vector <std::string>::iterator e;
|
||||
for (e = expanded.begin (); e != expanded.end (); ++e)
|
||||
this->push_back (Triple (*e, "", ""));
|
||||
|
||||
categorize ();
|
||||
expanded.clear ();
|
||||
categorize ();
|
||||
}
|
||||
}
|
||||
while (something && --safety_valve > 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue