diff --git a/scripts/cheat-autocompletion.bash b/scripts/cheat-autocompletion.bash index 4d340d1..dbb05e6 100755 --- a/scripts/cheat-autocompletion.bash +++ b/scripts/cheat-autocompletion.bash @@ -1,6 +1,9 @@ function _cheat_autocomplete { - wdlist='cheat -l|awk "{print $1}"' - COMPREPLY=(`compgen -W "$wdlist"`) + sheets=$(cheat -l | cut -d' ' -f1) + COMPREPLY=() + if [ $COMP_CWORD = 1 ]; then + COMPREPLY=(`compgen -W "$sheets" -- $2`) + fi } complete -F _cheat_autocomplete cheat