From 9ea270269660f1a1aa89bcc806e87b75f9105101 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 16 Jun 2015 21:39:16 -0400 Subject: [PATCH] CLI2: ::aliasExpansion now expands in both _args and _original_args --- src/CLI2.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 3abbb78ca..19d5cdab7 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -900,8 +900,7 @@ void CLI2::aliasExpansion () raw = i.attribute ("raw"); if (_aliases.find (raw) != _aliases.end ()) { - auto lexed = Lexer::split (_aliases[raw]); - for (auto& l : lexed) + for (auto& l : Lexer::split (_aliases[raw])) { A2 a (l, Lexer::Type::word); a.tag ("ALIAS"); @@ -917,6 +916,23 @@ void CLI2::aliasExpansion () } _args = reconstructed; + + std::vector reconstructedOriginals; + for (auto& i : _original_args) + { + if (_aliases.find (i) != _aliases.end ()) + { + for (auto& l : Lexer::split (_aliases[i])) + reconstructedOriginals.push_back (l); + + action = true; + changes = true; + } + else + reconstructedOriginals.push_back (i); + } + + _original_args = reconstructedOriginals; } while (action && counter++ < safetyValveDefault);