From 33e33dc7b779db30a833612af691d8f1b031ceaf Mon Sep 17 00:00:00 2001 From: James Zhu Date: Mon, 21 Oct 2019 18:07:26 +0800 Subject: [PATCH] adding the autocompletion back --- scripts/cheat-autocompletion.bash | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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