mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 15:47:19 +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 ()
|
void Arguments::resolve_aliases ()
|
||||||
{
|
{
|
||||||
std::vector <std::string> expanded;
|
std::vector <std::string> expanded;
|
||||||
bool something = false;
|
bool something;
|
||||||
|
int safety_valve = 10;
|
||||||
|
|
||||||
std::vector <Triple>::iterator arg;
|
do
|
||||||
for (arg = this->begin (); arg != this->end (); ++arg)
|
|
||||||
{
|
{
|
||||||
std::map <std::string, std::string>::iterator match =
|
something = false;
|
||||||
context.aliases.find (arg->_first);
|
std::vector <Triple>::iterator arg;
|
||||||
|
for (arg = this->begin (); arg != this->end (); ++arg)
|
||||||
if (match != context.aliases.end ())
|
|
||||||
{
|
{
|
||||||
context.debug (std::string ("Arguments::resolve_aliases '")
|
std::map <std::string, std::string>::iterator match =
|
||||||
+ arg->_first
|
context.aliases.find (arg->_first);
|
||||||
+ "' --> '"
|
|
||||||
+ context.aliases[arg->_first]
|
|
||||||
+ "'");
|
|
||||||
|
|
||||||
std::vector <std::string> words;
|
if (match != context.aliases.end ())
|
||||||
splitq (words, context.aliases[arg->_first], ' ');
|
{
|
||||||
|
context.debug (std::string ("Arguments::resolve_aliases '")
|
||||||
|
+ arg->_first
|
||||||
|
+ "' --> '"
|
||||||
|
+ context.aliases[arg->_first]
|
||||||
|
+ "'");
|
||||||
|
|
||||||
std::vector <std::string>::iterator word;
|
std::vector <std::string> words;
|
||||||
for (word = words.begin (); word != words.end (); ++word)
|
splitq (words, context.aliases[arg->_first], ' ');
|
||||||
expanded.push_back (*word);
|
|
||||||
|
|
||||||
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.
|
// Only overwrite if something happened.
|
||||||
if (something)
|
if (something)
|
||||||
{
|
{
|
||||||
this->clear ();
|
this->clear ();
|
||||||
std::vector <std::string>::iterator e;
|
std::vector <std::string>::iterator e;
|
||||||
for (e = expanded.begin (); e != expanded.end (); ++e)
|
for (e = expanded.begin (); e != expanded.end (); ++e)
|
||||||
this->push_back (Triple (*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