mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
22 lines
509 B
Bash
22 lines
509 B
Bash
_trezorctl()
|
|
{
|
|
export TREZORCTL_COMPLETION_CACHE
|
|
local cur prev cmds base
|
|
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
if [ -z "$TREZORCTL_COMPLETION_CACHE" ]; then
|
|
help_output=$(trezorctl --help | grep '^ [a-z]' | awk '{ print $1 }')
|
|
export TREZORCTL_COMPLETION_CACHE="$help_output"
|
|
fi
|
|
|
|
cmds="$TREZORCTL_COMPLETION_CACHE"
|
|
|
|
COMPREPLY=($(compgen -W "${cmds}" -- ${cur}))
|
|
return 0
|
|
}
|
|
|
|
complete -F _trezorctl trezorctl
|