diff options
author | David Paleino <dapal@debian.org> | 2013-11-04 17:58:57 +0100 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2013-11-04 17:58:57 +0100 |
commit | 059a87a5936cfebfd2d71ab8057002cafb2ea051 (patch) | |
tree | 7fafa4bb39a443ba4d49fccc852193adfea93564 /completions/ip | |
parent | 30649a02707d24744853f84946f744fdcf7c2757 (diff) | |
download | bash-completion-059a87a5936cfebfd2d71ab8057002cafb2ea051.tar.gz |
Imported Upstream version 2.1upstream/2.1
Diffstat (limited to 'completions/ip')
-rw-r--r-- | completions/ip | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/completions/ip b/completions/ip index 08ee74fe..b073c36f 100644 --- a/completions/ip +++ b/completions/ip @@ -1,5 +1,12 @@ # ip(8) completion -*- shell-script -*- +_iproute2_etc() +{ + COMPREPLY+=( $( compgen -W \ + "$( awk '!/#/ { print $2 }' /etc/iproute2/$1 2>/dev/null )" \ + -- "$cur" ) ) +} + _ip() { local cur prev words cword @@ -96,7 +103,14 @@ _ip() fi ;; show) - [[ $cword -eq $subcword+1 ]] && _available_interfaces + if [[ $cword -eq $subcword+1 ]]; then + _available_interfaces + COMPREPLY+=( $( compgen -W 'dev group up' -- "$cur" ) ) + elif [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == group ]]; then + _iproute2_etc group + fi ;; *) [[ $cword -eq $subcword ]] && \ @@ -115,7 +129,16 @@ _ip() # TODO ;; show|flush) - # TODO + if [[ $cword -eq $subcword+1 ]]; then + _available_interfaces + COMPREPLY+=( $( compgen -W 'dev scope to label dynamic + permanent tentative deprecated dadfailed temporary + primary secondary up' -- "$cur" ) ) + elif [[ $prev == dev ]]; then + _available_interfaces + elif [[ $prev == scope ]]; then + _iproute2_etc rt_scopes + fi ;; *) [[ $cword -eq $subcword ]] && \ @@ -159,9 +182,11 @@ _ip() rule) case $subcmd in - list|add|del|flush) + add|del) # TODO ;; + flush|show|list|lst) + ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help list add del flush' \ @@ -204,7 +229,9 @@ _ip() tunnel) case $subcmd in - add|change|del|show|prl|6rd) + show) + ;; + add|change|del|prl|6rd) # TODO ;; *) |