summaryrefslogtreecommitdiff
path: root/clients/cli/nmcli-completion
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-06-15 13:12:39 +0200
committerFrancesco Giudici <fgiudici@redhat.com>2016-06-21 16:28:48 +0200
commit3aff650e2219d45a9c353dfebe590a638a470727 (patch)
tree21d700b7d721f770c7e65174d1f98d960dd4f881 /clients/cli/nmcli-completion
parent5aec1a3928315ec45628563c00450bfce9285beb (diff)
downloadNetworkManager-3aff650e2219d45a9c353dfebe590a638a470727.tar.gz
nmcli: improve connection autocompletion (2/2)
Complete the property as we parse the list of properties. This makes it possible to actually complete an unfinished property. E.g: $ nmcli --complete c modify enp0s25 +ipv6.addr +ipv6.addresses +ipv6.addr-gen-mode
Diffstat (limited to 'clients/cli/nmcli-completion')
-rw-r--r--clients/cli/nmcli-completion20
1 files changed, 4 insertions, 16 deletions
diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion
index 7b653da414..d5bd80de5c 100644
--- a/clients/cli/nmcli-completion
+++ b/clients/cli/nmcli-completion
@@ -761,26 +761,14 @@ _nmcli_compl_COMMAND_nl() {
_nmcli_compl_PROPERTIES()
{
- while [[ "${#words[@]}" -gt 0 ]]; do
- if [[ ${#words[@]} -le 1 ]]; then
- local PREFIX="" item list=""
-
- if [[ "${words[0]:0:1}" == [+-] ]]; then
- PREFIX="${words[0]:0:1}"
- fi
- item="$(nmcli c modify --complete "$@" 2>/dev/null)"
- ### add prefix to each element
- for item in $item; do
- list="${list}${PREFIX}${item} "
- done
- _nmcli_list "$list"
- return 0
- elif [[ ${#words[@]} -le 2 ]]; then
+ while [[ ${#words[@]} -gt 0 ]]; do
+ if [[ ${#words[@]} -eq 1 ]]; then
+ _nmcli_list_nl "$(nmcli --complete-args connection modify "$@" "${words[@]}" 2>/dev/null)"
return 0
fi
_nmcli_array_delete_at words 0 1
done
- _nmcli_list "$(nmcli c modify --complete "$@" 2>/dev/null)"
+ return 0
}
_nmcli()