diff options
author | Thomas Haller <thaller@redhat.com> | 2013-08-21 19:45:45 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2013-08-28 14:36:49 +0200 |
commit | 2d2b2a48eb80c8db0b9adb943d0d269acf58a571 (patch) | |
tree | 6d910de400aef07c80af567f835bf541d650c6b4 | |
parent | ab231cb0d910456015b523617c2dffeb0a79ed82 (diff) | |
download | NetworkManager-2d2b2a48eb80c8db0b9adb943d0d269acf58a571.tar.gz |
cli: change completion to suggest connection ids
Before, whereever a connection id is accepted, the completion only
offered 'id', 'uuid', 'path', etc. With this change, it will additionally
suggest the id of existing connections.
https://bugzilla.redhat.com/show_bug.cgi?id=997997
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | cli/completion/nmcli | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/cli/completion/nmcli b/cli/completion/nmcli index ac66359ddc..74f5d10941 100644 --- a/cli/completion/nmcli +++ b/cli/completion/nmcli @@ -18,6 +18,11 @@ _nmcli_con_id() echo "$(nmcli -t -f NAME con show c 2>/dev/null)" } +_nmcli_con_id_active() +{ + echo "$(nmcli -t -f NAME con show a 2>/dev/null)" +} + _nmcli_con_uuid() { echo "$(nmcli -t -f UUID con show c 2>/dev/null)" @@ -301,11 +306,11 @@ _nmcli() if [[ ${#words[@]} -gt 3 ]]; then case $subcommand in c|co|con|conf|confi|config|configu|configur|configure|configured) - _nmcli_list "id uuid path" + _nmcli_list_nl "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_id)")" return 0 ;; a|ac|act|acti|activ|active) - _nmcli_list "id uuid path apath" + _nmcli_list_nl "$(printf "id\nuuid\npath\napath\n%s" "$(_nmcli_con_id_active)")" return 0 ;; esac @@ -318,12 +323,12 @@ _nmcli() if [[ "$cur" == -* ]]; then _nmcli_list "--nowait --timeout" else - _nmcli_list "id uuid path iface ap nsp" + _nmcli_list_nl "$(printf "id\nuuid\npath\niface\nap\nnsp\n%s" "$(_nmcli_con_id)")" fi return 0 ;; d|do|dow|down) - _nmcli_list "id uuid path apath" + _nmcli_list_nl "$(printf "id\nuuid\npath\napath\n%s" "$(_nmcli_con_id_active)")" return 0 ;; a|ad|add) @@ -331,15 +336,15 @@ _nmcli() return 0 ;; e|ed|edi|edit) - _nmcli_list "id uuid path type con-name" + _nmcli_list_nl "$(printf "id\nuuid\npath\ntype\n%s" "$(_nmcli_con_id)")" return 0 ;; m|mo|mod|modi|modif|modify) - _nmcli_list_nl "$(_nmcli_con_id)" + _nmcli_list_nl "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_id)")" return 0 ;; de|del|dele|delet|delete) - _nmcli_list "id uuid path" + _nmcli_list_nl "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_id)")" return 0 ;; esac |