diff --git a/bash_completion.d/trezorctl.sh b/bash_completion.d/trezorctl.sh new file mode 100644 index 0000000..ec1b30e --- /dev/null +++ b/bash_completion.d/trezorctl.sh @@ -0,0 +1,14 @@ +_trezorctl() +{ + local cur prev cmds base + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + cmds=$(trezorctl --help | grep -A 1 'Available commands:' | tail -n 1 | tr '{},' ' ') + + COMPREPLY=($(compgen -W "${cmds}" -- ${cur})) + return 0 +} + +complete -F _trezorctl trezorctl