cli: check for global options before each agument

Turn --ask and --show-secrets into global options. This is for user
comfort, see: rh #1351263.
This commit is contained in:
Lubomir Rintel
2017-03-24 14:35:56 +01:00
parent 5a71bc8022
commit f909ef421b
2 changed files with 26 additions and 13 deletions

View File

@@ -231,8 +231,8 @@ process_command_line (NmCli *nmc, int argc, char **argv)
if (argc == 1 && nmc->complete) {
nmc_complete_strings (opt, "--terse", "--pretty", "--mode", "--colors", "--escape",
"--fields", "--nocheck", "--ask", "--show-secrets",
"--get-values", "--wait", "--version", "--help", NULL);
"--fields", "--nocheck", "--get-values",
"--wait", "--version", "--help", NULL);
}
if (opt[1] == '-') {
@@ -360,10 +360,6 @@ process_command_line (NmCli *nmc, int argc, char **argv)
nmc->mode_specified = TRUE;
} else if (matches (opt, "-nocheck")) {
/* ignore for backward compatibility */
} else if (matches (opt, "-ask")) {
nmc->ask = TRUE;
} else if (matches (opt, "-show-secrets")) {
nmc->show_secrets = TRUE;
} else if (matches (opt, "-wait")) {
unsigned long timeout;
if (!argc) {