1
1
mirror of https://github.com/chubin/cheat.sh.git synced 2024-11-23 19:43:33 +03:00
cheat.sh/share/bash_completion.txt
2018-05-19 20:03:19 +00:00

18 lines
386 B
Plaintext

_cht_complete()
{
local cur prev opts
_get_comp_words_by_ref -n : cur
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="$(curl -s cheat.sh/:list)"
if [ ${COMP_CWORD} = 1 ]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
__ltrim_colon_completions "$cur"
fi
return 0
}
complete -F _cht_complete cht.sh