cli: remove spurious device names from output

When running one of:

 nmcli device wifi list ifname wlan0
 nmcli device wifi connect ... ifname wlan0

nmcli wrongly adds the device name to the output.

Do the completion only when requested.

Fixes: 8679793f6b
Fixes: 1a0dfd31c4
This commit is contained in:
Beniamino Galvani 2017-06-11 22:31:43 +02:00
parent 17e7054d73
commit d2b4332b36

View file

@ -2625,7 +2625,8 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
return NMC_RESULT_ERROR_USER_INPUT;
}
ifname = *argv;
complete_device (devices, ifname, TRUE);
if (argc == 1 && nmc->complete)
complete_device (devices, ifname, TRUE);
} else if (strcmp (*argv, "bssid") == 0 || strcmp (*argv, "hwaddr") == 0) {
/* hwaddr is deprecated and will be removed later */
argc--;
@ -2878,7 +2879,8 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
goto finish;
}
ifname = *argv;
complete_device (devices, ifname, TRUE);
if (argc == 1 && nmc->complete)
complete_device (devices, ifname, TRUE);
} else if (strcmp (*argv, "bssid") == 0) {
argc--;
argv++;