mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
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.
This commit is contained in:
parent
5ae32dd036
commit
7da3f3b2ba
1 changed files with 7 additions and 28 deletions
35
src/CLI2.cpp
35
src/CLI2.cpp
|
@ -545,6 +545,9 @@ void CLI2::analyze ()
|
||||||
|
|
||||||
demotion ();
|
demotion ();
|
||||||
canonicalizeNames ();
|
canonicalizeNames ();
|
||||||
|
|
||||||
|
// Determine arg types: FILTER, MODIFICATION, MISCELLANEOUS.
|
||||||
|
categorizeArgs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -619,9 +622,6 @@ void CLI2::prepareFilter ()
|
||||||
_id_ranges.clear ();
|
_id_ranges.clear ();
|
||||||
_uuid_list.clear ();
|
_uuid_list.clear ();
|
||||||
|
|
||||||
// Determine arg types: FILTER, MODIFICATION, MISCELLANEOUS.
|
|
||||||
categorizeArgs ();
|
|
||||||
|
|
||||||
// Remove all the syntactic sugar for FILTERs.
|
// Remove all the syntactic sugar for FILTERs.
|
||||||
lexFilterArgs ();
|
lexFilterArgs ();
|
||||||
findIDs ();
|
findIDs ();
|
||||||
|
@ -636,34 +636,13 @@ void CLI2::prepareFilter ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Get the original command line arguments, in pristine condition, but skipping:
|
// Return all the MISCELLANEOUS args.
|
||||||
// - BINARY
|
|
||||||
// - CMD
|
|
||||||
// - RC
|
|
||||||
// - CONFIG
|
|
||||||
// - --
|
|
||||||
const std::vector <std::string> CLI2::getWords (bool filtered)
|
const std::vector <std::string> CLI2::getWords (bool filtered)
|
||||||
{
|
{
|
||||||
auto binary = getBinary ();
|
|
||||||
auto command = getCommand ();
|
|
||||||
auto commandRaw = getCommand (false);
|
|
||||||
|
|
||||||
std::vector <std::string> words;
|
std::vector <std::string> words;
|
||||||
for (auto& a : _original_args)
|
for (auto& a : _args)
|
||||||
{
|
if (a.hasTag ("MISCELLANEOUS"))
|
||||||
if (a != binary &&
|
words.push_back (a.attribute ("raw"));
|
||||||
a != command &&
|
|
||||||
a != commandRaw &&
|
|
||||||
a != "--")
|
|
||||||
{
|
|
||||||
if (! filtered ||
|
|
||||||
(a.find ("rc:") != 0 &&
|
|
||||||
a.find ("rc.") != 0))
|
|
||||||
{
|
|
||||||
words.push_back (a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.config.getInteger ("debug.parser") >= 3)
|
if (context.config.getInteger ("debug.parser") >= 3)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue