diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2016-07-12 10:15:01 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2016-08-01 13:52:36 +0200 |
commit | 4302e05b1a0b0357040459be15ea90cf5cc8f9a7 (patch) | |
tree | fb4cbcf2a613f2aaa5fa5dfd967419ec04195145 | |
parent | d2842d16e3f8bde632f1698bb2c6e635489f42aa (diff) | |
download | NetworkManager-4302e05b1a0b0357040459be15ea90cf5cc8f9a7.tar.gz |
cli/device: make it possible to limit completion to wifis
-rw-r--r-- | clients/cli/devices.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 7990cc7dbf..bceae7380a 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -538,13 +538,16 @@ nmc_get_devices_sorted (NMClient *client) } static void -complete_device (NMDevice **devices, const char *prefix) +complete_device (NMDevice **devices, const char *prefix, gboolean wifi_only) { int i; for (i = 0; devices[i]; i++) { const char *iface = nm_device_get_iface (devices[i]); + if (wifi_only && !NM_IS_DEVICE_WIFI (devices[i])) + continue; + if (g_str_has_prefix (iface, prefix)) g_print ("%s\n", iface); } @@ -578,7 +581,7 @@ get_device_list (NmCli *nmc, int argc, char **argv) devices = nmc_get_devices_sorted (nmc->client); while (arg_num > 0) { if (arg_num == 1 && nmc->complete) - complete_device (devices, *arg_ptr); + complete_device (devices, *arg_ptr, FALSE); device = NULL; for (i = 0; devices[i]; i++) { @@ -640,7 +643,7 @@ get_device (NmCli *nmc, int *argc, char ***argv, GError **error) } if (nmc->complete && !*argc) - complete_device (devices, ifname); + complete_device (devices, ifname, FALSE); if (devices[i] == NULL) { g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_NOT_FOUND, |