summary refs log tree commit diff
path: root/clients/cli/nmcli-completion
diff options
context:
space:
mode:
Diffstat (limited to 'clients/cli/nmcli-completion')
-rw-r--r--clients/cli/nmcli-completion33
1 files changed, 32 insertions, 1 deletions
diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion
index 4146eae0..7bdd5255 100644
--- a/clients/cli/nmcli-completion
+++ b/clients/cli/nmcli-completion
@@ -41,6 +41,20 @@ _nmcli_list_nl()
         fi
         (( i++ ))
     done
+
+    # Work-around bash_completion issue where bash interprets a colon
+    # as a separator.
+    # Colon is escaped here. Change "\\:" back to ":".
+    # See also:
+    # http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons
+    # http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727
+    i=0
+    for entry in ${COMPREPLY[*]}
+    do
+        entry="${entry//\\\\:/:}"
+        COMPREPLY[$i]=${entry}
+        (( i++ ))
+    done
 }
 
 _nmcli_con_show()
@@ -353,7 +367,7 @@ _nmcli_compl_ARGS()
                         # user friendly. Only complete them, if the current word already starts with an "8".
                         _nmcli_list "802-3-ethernet 802-11-wireless 802-11-olpc-mesh"
                     else
-                        _nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bond-slave bridge bridge-slave team team-slave pppoe"
+                        _nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bond-slave bridge bridge-slave team team-slave pppoe adsl"
                     fi
                     return 0
                 fi
@@ -522,6 +536,18 @@ _nmcli_compl_ARGS()
                     return 0
                 fi
                 ;;
+            encapsulation)
+                if [[ "${#words[@]}" -eq 2 ]]; then
+                    _nmcli_list "vcmux llc"
+                    return 0
+                fi
+                ;;
+            protocol)
+                if [[ "${#words[@]}" -eq 2 ]]; then
+                    _nmcli_list "pppoa pppoe ipoatm"
+                    return 0
+                fi
+                ;;
             *)
                 return 1
                 ;;
@@ -1010,6 +1036,11 @@ _nmcli()
                                     OPTIONS_TYPED=(username password service mtu mac)
                                     OPTIONS_MANDATORY=(username)
                                     ;;
+                                a|ad|ads|adsl)
+                                    OPTIONS_TYPE=adsl
+                                    OPTIONS_TYPED=(username password protocol encapsulation)
+                                    OPTIONS_MANDATORY=(username protocol)
+                                    ;;
                                 *)
                                     # for an unknown connection type, we stop completion here
                                     return 0