File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 11# bash completion for brctl -*- shell-script -*-
22
3+ _comp_cmd_brctl__interfaces ()
4+ {
5+ _comp_compgen_split -- " $( ${1:- brctl} show ${2: +" $2 " } 2> /dev/null | _comp_awk \
6+ ' (NR == 1) { next }; (/^\t/) { print $1; next }; { print $4 }' ) "
7+ }
8+
39_comp_cmd_brctl ()
410{
511 local cur prev words cword comp_args
@@ -15,18 +21,21 @@ _comp_cmd_brctl()
1521 ;;
1622 2)
1723 case $command in
18- show ) ;;
24+ addbr ) ;;
1925
2026 * )
2127 _comp_compgen_split -- " $( " $1 " show |
22- _comp_awk ' NR>1 {print $1}' ) "
28+ _comp_awk ' ( NR>1 && !/^\t/) {print $1}' ) "
2329 ;;
2430 esac
2531 ;;
2632 3)
2733 case $command in
28- addif | delif)
29- _comp_compgen_configured_interfaces
34+ addif)
35+ _comp_compgen_available_interfaces
36+ ;;
37+ delif)
38+ _comp_cmd_brctl__interfaces " $1 " " $prev "
3039 ;;
3140 stp)
3241 _comp_compgen -- -W ' on off'
@@ -35,6 +44,6 @@ _comp_cmd_brctl()
3544 ;;
3645 esac
3746} &&
38- complete -F _comp_cmd_brctl -o default brctl
47+ complete -F _comp_cmd_brctl brctl
3948
4049# ex: filetype=sh
You can’t perform that action at this time.
0 commit comments