diff options
-rw-r--r-- | clients/cli/devices.c | 10 | ||||
-rw-r--r-- | clients/cli/nmcli-completion | 7 | ||||
-rw-r--r-- | man/nmcli.1.in | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 66f4ad3967..b8b4a23fdf 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -259,7 +259,7 @@ usage (void) "COMMAND := { status | show | connect | disconnect | delete | wifi }\n\n" " status\n\n" " show [<ifname>]\n\n" - " set <ifname> [autoconnect yes|no] [managed yes|no]\n\n" + " set [ifname] <ifname> [autoconnect yes|no] [managed yes|no]\n\n" " connect <ifname>\n\n" " disconnect <ifname> ...\n\n" " delete <ifname> ...\n\n" @@ -338,7 +338,8 @@ usage_device_set (void) { g_printerr (_("Usage: nmcli device set { ARGUMENTS | help }\n" "\n" - "ARGUMENTS := <ifname> { PROPERTY [ PROPERTY ... ] }\n" + "ARGUMENTS := DEVICE { PROPERTY [ PROPERTY ... ] }\n" + "DEVICE := [ifname] <ifname> \n" "PROPERTY := { autoconnect { yes | no } |\n" " { managed { yes | no }\n" "\n" @@ -1925,6 +1926,11 @@ do_device_set (NmCli *nmc, int argc, char **argv) [DEV_SET_MANAGED] = { -1 }, }; + if (argc >= 1 && g_strcmp0 (*argv, "ifname") == 0) { + argc--; + argv++; + } + if (argc == 0) { g_string_printf (nmc->return_text, _("Error: No interface specified.")); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion index a37e1fcc78..909c00e299 100644 --- a/clients/cli/nmcli-completion +++ b/clients/cli/nmcli-completion @@ -596,6 +596,7 @@ _nmcli_compl_ARGS() # some commands expect a connection as parameter. This connection can either be given # as id|uuid|path|apath. Parse that connection parameter. +# Actually, it can also ask for a device name, like `nmcli device set [ifname] <ifname>` _nmcli_compl_ARGS_CONNECTION() { if ! _nmcli_array_has_value OPTIONS "${words[0]}"; then @@ -1274,9 +1275,11 @@ _nmcli() ;; se|set) if [[ ${#words[@]} -eq 3 ]]; then - _nmcli_compl_COMMAND_nl "${words[2]}" "$(_nmcli_dev_status DEVICE)" + _nmcli_compl_COMMAND_nl "${words[2]}" "$(printf "ifname\n%s" "$(_nmcli_con_show NAME)")" else - _nmcli_array_delete_at words 0 2 + _nmcli_array_delete_at words 0 1 + OPTIONS=(ifname) + _nmcli_compl_ARGS_CONNECTION && return 0 OPTIONS=(autoconnect managed) _nmcli_compl_ARGS fi diff --git a/man/nmcli.1.in b/man/nmcli.1.in index 49da0252d8..15781c4964 100644 --- a/man/nmcli.1.in +++ b/man/nmcli.1.in @@ -774,7 +774,7 @@ examined. To get information for a specific device, the interface name has to be provided. .TP .TP -.B set <ifname> [autoconnect yes|no] [managed yes|no] +.B set [ifname] <ifname> [autoconnect yes|no] [managed yes|no] .br Set device properties. .TP |