diff --git a/scripts/cheat-autocompletion.bash b/scripts/cheat-autocompletion.bash new file mode 100755 index 0000000..95f6288 --- /dev/null +++ b/scripts/cheat-autocompletion.bash @@ -0,0 +1,9 @@ +function _cheat_autocomplete { + sheets=$(cheat -l | sed -n '2,$p'|cut -d' ' -f1) + COMPREPLY=() + if [ $COMP_CWORD = 1 ]; then + COMPREPLY=(`compgen -W "$sheets" -- $2`) + fi +} + +complete -F _cheat_autocomplete cheat