Skip to content

Commit 7e42273

Browse files
committed
fix(brctl): switch handling of show and addbr
The show subcommand accepts a bridge name as a paramenter so let's offer completion. On the other hand addbr creates new interface and requires a name that doesn't exist yet. Longer awk condition prevents offering interfaces that are parts of bridges. They are all displayed in the last column but with all other columns being blang on the second and following lines of each bridge the last column is also the first.
1 parent a06b5f8 commit 7e42273

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

completions/brctl

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ _brctl()
3030
;;
3131
2)
3232
case $command in
33-
show) ;;
33+
addbr) ;;
3434

3535
*)
3636
COMPREPLY=($(compgen -W "$("$1" show |
37-
awk 'NR>1 {print $1}')" -- "$cur"))
37+
awk '(NR>1 && !/^\t/) {print $1}')" -- "$cur"))
3838
;;
3939
esac
4040
;;

0 commit comments

Comments
 (0)