[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-124-geef7941
Ville Skyttä
ville.skytta at iki.fi
Mon Feb 4 15:30:40 UTC 2013
The following commit has been merged in the master branch:
commit 61fe8d10a8e15285e2ad152017403e8bb609614b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Feb 4 17:24:47 2013 +0200
ip: Improve addr show and link show completions.
diff --git a/completions/ip b/completions/ip
index e9e60d7..b073c36 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 ]] && \
--
bash-completion
More information about the Bash-completion-commits
mailing list