Skip to content

Commit a06b5f8

Browse files
committed
feat(brctl): for delif commnd offer only bridged interfaces
When completing a delif command offer only interfaces that are part of the selected bridge.
1 parent 5fb991e commit a06b5f8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

completions/brctl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
# bash completion for brctl -*- shell-script -*-
2+
_brctl_interfaces()
3+
{
4+
local PATH=$PATH:/sbin
5+
COMPREPLY=($({
6+
if [[ -z "$1" ]]; then
7+
brctl show
8+
else
9+
brctl show "$1"
10+
fi
11+
} 2>/dev/null | awk \
12+
'(NR == 1) { next }; (/^\t/) { print $1; next }; { print $4 }'))
13+
14+
((${#COMPREPLY[@]})) &&
15+
COMPREPLY=($(compgen -W '"${COMPREPLY[@]/%[[:punct:]]/}"' -- "$cur"))
16+
}
217

318
_brctl()
419
{
@@ -25,9 +40,12 @@ _brctl()
2540
;;
2641
3)
2742
case $command in
28-
addif | delif)
43+
addif)
2944
_available_interfaces
3045
;;
46+
delif)
47+
_brctl_interfaces "$prev"
48+
;;
3149
stp)
3250
COMPREPLY=($(compgen -W 'on off' -- "$cur"))
3351
;;

0 commit comments

Comments
 (0)