mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CLI
- Made argument termination (--) persists across ::addArg calls.
This commit is contained in:
parent
a00c5b11c8
commit
6e906e4dbf
2 changed files with 16 additions and 5 deletions
12
src/CLI.cpp
12
src/CLI.cpp
|
@ -308,6 +308,7 @@ void CLI::applyOverrides (int argc, const char** argv)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CLI::CLI ()
|
CLI::CLI ()
|
||||||
: _strict (false)
|
: _strict (false)
|
||||||
|
, _terminated (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,10 +348,16 @@ void CLI::initialize (int argc, const char** argv)
|
||||||
_original_args.clear ();
|
_original_args.clear ();
|
||||||
_id_ranges.clear ();
|
_id_ranges.clear ();
|
||||||
_uuid_list.clear ();
|
_uuid_list.clear ();
|
||||||
|
_terminated = false;
|
||||||
|
|
||||||
_original_args.push_back (argv[0]);
|
_original_args.push_back (argv[0]);
|
||||||
|
bool terminated = false;
|
||||||
for (int i = 1; i < argc; ++i)
|
for (int i = 1; i < argc; ++i)
|
||||||
|
{
|
||||||
|
if (isTerminator (argv[i]))
|
||||||
|
_terminated = true;
|
||||||
addArg (argv[i]);
|
addArg (argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
analyze ();
|
analyze ();
|
||||||
}
|
}
|
||||||
|
@ -619,7 +626,10 @@ void CLI::addArg (const std::string& arg)
|
||||||
std::string raw = trim (arg);
|
std::string raw = trim (arg);
|
||||||
|
|
||||||
// Do not lex these constructs.
|
// Do not lex these constructs.
|
||||||
if (isTerminator (raw) || // --
|
if (isTerminator (raw)) // --
|
||||||
|
_terminated = true;
|
||||||
|
|
||||||
|
if (_terminated ||
|
||||||
isRCOverride (raw) || // rc:<file>
|
isRCOverride (raw) || // rc:<file>
|
||||||
isConfigOverride (raw) || // rc.<attr>:<value>
|
isConfigOverride (raw) || // rc.<attr>:<value>
|
||||||
isCommand (raw) || // <cmd>
|
isCommand (raw) || // <cmd>
|
||||||
|
|
|
@ -134,6 +134,7 @@ public:
|
||||||
std::vector <std::pair <int, int> > _id_ranges;
|
std::vector <std::pair <int, int> > _id_ranges;
|
||||||
std::vector <std::string> _uuid_list;
|
std::vector <std::string> _uuid_list;
|
||||||
bool _strict;
|
bool _strict;
|
||||||
|
bool _terminated;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue