nmcli: fix nmcli parsing

Fixes the parsing for correct and incorrect commands.
e.g.:
nmcli connection down id <conn>
nmcli -t
...

Fixes: 16902a2be6
(cherry picked from commit ef0d0d08eb)
This commit is contained in:
Francesco Giudici
2017-03-29 12:02:14 +02:00
parent 9a38eb4c66
commit f7c72045b7
4 changed files with 80 additions and 73 deletions

View File

@@ -655,24 +655,24 @@ do_general_logging (NmCli *nmc, int argc, char **argv)
nmc_complete_strings (*argv, "level", "domains", NULL);
if (matches (*argv, "level")) {
argc--;
argv++;
if (!argc) {
g_string_printf (nmc->return_text, _("Error: '%s' argument is missing."), *(argv-1));
return NMC_RESULT_ERROR_USER_INPUT;
}
argc--;
argv++;
if (argc == 1 && nmc->complete) {
nmc_complete_strings_nocase (*argv, "TRACE", "DEBUG", "INFO", "WARN",
"ERR", "OFF", "KEEP", NULL);
}
level = *argv;
} else if (matches (*argv, "domains")) {
argc--;
argv++;
if (!argc) {
g_string_printf (nmc->return_text, _("Error: '%s' argument is missing."), *(argv-1));
return NMC_RESULT_ERROR_USER_INPUT;
}
argc--;
argv++;
if (argc == 1 && nmc->complete) {
nmc_complete_strings_nocase (*argv, "PLATFORM", "RFKILL", "ETHER", "WIFI", "BT",
"MB", "DHCP4", "DHCP6", "PPP", "WIFI_SCAN", "IP4",