/usr/share/bash-completion/completions/tbtadm is in thunderbolt-tools 0.9.3-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | _tbtadm()
{
local cur prev opts acl devices
acl=/var/lib/thunderbolt/acl
devices=/sys/bus/thunderbolt/devices
COMPREPLY=()
cur="$2"
command="${COMP_WORDS[1]}"
opts="devices peers topology approve approve-all acl add remove remove-all"
case "$command" in
approve|add|remove)
local routestrings
routestrings="$( [ -d ${devices} ] && command ls ${devices} | command grep -v domain | command grep -Fv . | command grep -v [0-9]-0)"
COMPREPLY+=( $(compgen -W "${routestrings}" -- "$cur") )
;;&
approve|approve-all)
COMPREPLY+=( $(compgen -W "--once" -- "$cur") )
;;
remove)
local uuids
uuids="$( [ -d ${acl} ] && command ls ${acl})"
COMPREPLY+=( $(compgen -W "${uuids}" -- "$cur") )
;;
*)
if [[ ${COMP_CWORD} = 1 ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
fi
;;
esac;
return 0
}
complete -F _tbtadm tbtadm
|