1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-29 17:48:10 +00:00
trezor-firmware/python/bash_completion.d/trezorctl.sh

22 lines
509 B
Bash
Raw Normal View History

2016-06-22 15:26:11 +00:00
_trezorctl()
{
2018-10-25 00:25:25 +00:00
export TREZORCTL_COMPLETION_CACHE
2016-06-22 15:26:11 +00:00
local cur prev cmds base
2018-10-25 00:25:25 +00:00
2016-06-22 15:26:11 +00:00
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
2018-10-25 00:25:25 +00:00
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"
2016-06-22 15:26:11 +00:00
COMPREPLY=($(compgen -W "${cmds}" -- ${cur}))
return 0
}
complete -F _trezorctl trezorctl