mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug Fix
- Now allows abbreviations of aliases. - No longer truncates commands after --.
This commit is contained in:
parent
f2af6cc2dd
commit
e20e05ab54
1 changed files with 24 additions and 10 deletions
|
@ -280,6 +280,17 @@ std::string Context::canonicalize (const std::string& input) const
|
||||||
{
|
{
|
||||||
std::string canonical = input;
|
std::string canonical = input;
|
||||||
|
|
||||||
|
// First try to autocomplete the alias.
|
||||||
|
std::vector <std::string> options;
|
||||||
|
std::vector <std::string> matches;
|
||||||
|
foreach (name, aliases)
|
||||||
|
options.push_back (name->first);
|
||||||
|
|
||||||
|
autoComplete (input, options, matches);
|
||||||
|
if (matches.size () == 1)
|
||||||
|
{
|
||||||
|
canonical = matches[0];
|
||||||
|
|
||||||
// Follow the chain.
|
// Follow the chain.
|
||||||
int i = 10; // Safety valve.
|
int i = 10; // Safety valve.
|
||||||
std::map <std::string, std::string>::const_iterator found;
|
std::map <std::string, std::string>::const_iterator found;
|
||||||
|
@ -288,6 +299,7 @@ std::string Context::canonicalize (const std::string& input) const
|
||||||
|
|
||||||
if (i < 1)
|
if (i < 1)
|
||||||
return input;
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
return canonical;
|
return canonical;
|
||||||
}
|
}
|
||||||
|
@ -362,11 +374,13 @@ void Context::loadCorrectConfigFile ()
|
||||||
|
|
||||||
// Apply overrides of type: "rc.name:value"
|
// Apply overrides of type: "rc.name:value"
|
||||||
std::vector <std::string> filtered;
|
std::vector <std::string> filtered;
|
||||||
|
bool foundTerminator = false;
|
||||||
foreach (arg, args)
|
foreach (arg, args)
|
||||||
{
|
{
|
||||||
if (*arg == "--")
|
if (*arg == "--")
|
||||||
break;
|
foundTerminator = true;
|
||||||
else if (arg->substr (0, 3) == "rc.")
|
else if (!foundTerminator &&
|
||||||
|
arg->substr (0, 3) == "rc.")
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string value;
|
std::string value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue