mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CLI
- Implemented ::isConfigOverride, and used it.
This commit is contained in:
parent
91f4eade50
commit
d5e6aa7640
2 changed files with 16 additions and 5 deletions
20
src/CLI.cpp
20
src/CLI.cpp
|
@ -477,9 +477,10 @@ const std::string CLI::dump () const
|
|||
void CLI::addArg (const std::string& arg)
|
||||
{
|
||||
// Do not lex RC overrides.
|
||||
if (arg.length () > 3 &&
|
||||
(arg.substr (0, 3) == "rc." ||
|
||||
arg.substr (0, 3) == "rc:"))
|
||||
if (isRCOverride (arg))
|
||||
_original_args.push_back (arg);
|
||||
|
||||
if (isConfigOverride (arg))
|
||||
_original_args.push_back (arg);
|
||||
|
||||
// Do not lex patterns or single substitutions.
|
||||
|
@ -601,12 +602,12 @@ void CLI::findOverrides ()
|
|||
if (terminated)
|
||||
continue;
|
||||
|
||||
if (raw.find ("rc:") == 0)
|
||||
if (isRCOverride (raw))
|
||||
{
|
||||
a->tag ("RC");
|
||||
a->attribute ("file", raw.substr (3));
|
||||
}
|
||||
else if (raw.find ("rc.") == 0)
|
||||
else if (isConfigOverride (raw))
|
||||
{
|
||||
std::string::size_type sep = raw.find ('=', 3);
|
||||
if (sep == std::string::npos)
|
||||
|
@ -1700,6 +1701,15 @@ bool CLI::isRCOverride (const std::string& raw) const
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CLI::isConfigOverride (const std::string& raw) const
|
||||
{
|
||||
if (raw.length () > 3 && raw.substr (0, 3) == "rc.")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CLI::isUUID (const std::string& raw) const
|
||||
{
|
||||
|
|
|
@ -99,6 +99,7 @@ private:
|
|||
void decomposeModSubstitutions ();
|
||||
|
||||
bool isRCOverride (const std::string&) const;
|
||||
bool isConfigOverride (const std::string&) const;
|
||||
bool isUUID (const std::string&) const;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue