mirror of https://github.com/Icinga/icinga2.git
parent
5960753015
commit
a2e70955e1
|
@ -171,6 +171,7 @@ bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& vi
|
||||||
|
|
||||||
std::vector<String> best_match;
|
std::vector<String> best_match;
|
||||||
int arg_end = 0;
|
int arg_end = 0;
|
||||||
|
bool tried_command = false;
|
||||||
|
|
||||||
for (const CLIKeyValue& kv : GetRegistry()) {
|
for (const CLIKeyValue& kv : GetRegistry()) {
|
||||||
const std::vector<String>& vname = kv.first;
|
const std::vector<String>& vname = kv.first;
|
||||||
|
@ -178,11 +179,13 @@ bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& vi
|
||||||
std::vector<String>::size_type i;
|
std::vector<String>::size_type i;
|
||||||
int k;
|
int k;
|
||||||
for (i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
|
for (i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
|
||||||
if (strcmp(argv[k], "--no-stack-rlimit") == 0 || strcmp(argv[k], "--autocomplete") == 0 || strcmp(argv[k], "--scm") == 0) {
|
if (strncmp(argv[k], "--", 2) == 0) {
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tried_command = true;
|
||||||
|
|
||||||
if (vname[i] != argv[k])
|
if (vname[i] != argv[k])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -207,7 +210,7 @@ found_command:
|
||||||
visibleDesc.add(vdesc);
|
visibleDesc.add(vdesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autocomplete || !command)
|
if (autocomplete || (tried_command && !command))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
po::options_description adesc;
|
po::options_description adesc;
|
||||||
|
|
Loading…
Reference in New Issue