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 1
1
# bash completion for brctl -*- shell-script -*-
2
2
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
+
3
9
_comp_cmd_brctl ()
4
10
{
5
11
local cur prev words cword comp_args
@@ -15,18 +21,21 @@ _comp_cmd_brctl()
15
21
;;
16
22
2)
17
23
case $command in
18
- show ) ;;
24
+ addbr ) ;;
19
25
20
26
* )
21
27
_comp_compgen_split -- " $( " $1 " show |
22
- _comp_awk ' NR>1 {print $1}' ) "
28
+ _comp_awk ' ( NR>1 && !/^\t/) {print $1}' ) "
23
29
;;
24
30
esac
25
31
;;
26
32
3)
27
33
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 "
30
39
;;
31
40
stp)
32
41
_comp_compgen -- -W ' on off'
@@ -35,6 +44,6 @@ _comp_cmd_brctl()
35
44
;;
36
45
esac
37
46
} &&
38
- complete -F _comp_cmd_brctl -o default brctl
47
+ complete -F _comp_cmd_brctl brctl
39
48
40
49
# ex: filetype=sh
You can’t perform that action at this time.
0 commit comments