1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

cache autocompletion

This commit is contained in:
Vladyslav Burzakovskyy 2018-10-25 02:25:25 +02:00 committed by matejcik
parent 7bd3cd6b13
commit cc908fb90c
2 changed files with 9 additions and 2 deletions

View File

@ -1,11 +1,18 @@
_trezorctl() _trezorctl()
{ {
export TREZORCTL_COMPLETION_CACHE
local cur prev cmds base local cur prev cmds base
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
cmds=$(trezorctl --help | grep '^ [a-z]' | awk '{ print $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})) COMPREPLY=($(compgen -W "${cmds}" -- ${cur}))
return 0 return 0

@ -1 +1 @@
Subproject commit dacbc7260cc6c2c77001186d50a59ccbfb73dbb0 Subproject commit 11221cfe1cc5bda4d7b999517e92dd87ad00f2bc