Skip to content

Commit

Permalink
feat(brctl): for delif commnd offer only bridged interfaces
Browse files Browse the repository at this point in the history
When completing a delif command offer only interfaces that are part of
the selected bridge.
  • Loading branch information
steelman committed Nov 29, 2024
1 parent b5a7cd8 commit de3dc35
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion completions/brctl
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# bash completion for brctl -*- shell-script -*-
_comp_xfunc_brctl_interfaces()
{
_comp_compgen_split -- "$(${1:-brctl} show ${2:+"$2"} 2>/dev/null | _comp_awk \
'(NR == 1) { next }; (/^\t/) { print $1; next }; { print $4 }')"
}

_comp_cmd_brctl()
{
Expand All @@ -25,9 +30,12 @@ _comp_cmd_brctl()
;;
3)
case $command in
addif | delif)
addif)
_comp_compgen_available_interfaces
;;
delif)
_comp_xfunc_brctl_interfaces "$1" "$prev"
;;
stp)
_comp_compgen -- -W 'on off'
;;
Expand Down

0 comments on commit de3dc35

Please sign in to comment.