adding the autocompletion back

This commit is contained in:
James Zhu 2019-10-21 18:07:26 +08:00
parent 201cd1d629
commit 33e33dc7b7
1 changed files with 5 additions and 2 deletions

View File

@ -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