From 7da3f3b2bab5359f3e0182f047caa875442cabc9 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Sep 2015 01:02:06 -0400 Subject: [PATCH] CLI2: Moved arg categorization earlier in the processing - Moving categorization (FILTER, MODIFICATION, MISCELLANEOUS) int ::analyze, instead of waiting until ::prepareFilter means that all commands now have access to categorized args. This means there is no need to repeatedly scan and skip over 'rc:' etc. --- src/CLI2.cpp | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index df11b0377..0599b530e 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -545,6 +545,9 @@ void CLI2::analyze () demotion (); canonicalizeNames (); + + // Determine arg types: FILTER, MODIFICATION, MISCELLANEOUS. + categorizeArgs (); } //////////////////////////////////////////////////////////////////////////////// @@ -619,9 +622,6 @@ void CLI2::prepareFilter () _id_ranges.clear (); _uuid_list.clear (); - // Determine arg types: FILTER, MODIFICATION, MISCELLANEOUS. - categorizeArgs (); - // Remove all the syntactic sugar for FILTERs. lexFilterArgs (); findIDs (); @@ -636,34 +636,13 @@ void CLI2::prepareFilter () } //////////////////////////////////////////////////////////////////////////////// -// Get the original command line arguments, in pristine condition, but skipping: -// - BINARY -// - CMD -// - RC -// - CONFIG -// - -- +// Return all the MISCELLANEOUS args. const std::vector CLI2::getWords (bool filtered) { - auto binary = getBinary (); - auto command = getCommand (); - auto commandRaw = getCommand (false); - std::vector words; - for (auto& a : _original_args) - { - if (a != binary && - a != command && - a != commandRaw && - a != "--") - { - if (! filtered || - (a.find ("rc:") != 0 && - a.find ("rc.") != 0)) - { - words.push_back (a); - } - } - } + for (auto& a : _args) + if (a.hasTag ("MISCELLANEOUS")) + words.push_back (a.attribute ("raw")); if (context.config.getInteger ("debug.parser") >= 3) {