Skip to content

Commit

Permalink
fix(brctl): switch handling of show and addbr
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
steelman committed Nov 29, 2024
1 parent 1d62c29 commit 9d87e5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions completions/brctl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ _comp_cmd_brctl()
;;
2)
case $command in
show) ;;
addbr) ;;

*)
_comp_compgen_split -- "$("$1" show |
_comp_awk 'NR>1 {print $1}')"
_comp_awk '(NR>1 && !/^\t/) {print $1}')"
;;
esac
;;
Expand Down

0 comments on commit 9d87e5b

Please sign in to comment.