diff options
| author | Vito Graffagnino <vito@graffagnino.xyz> | 2020-09-08 13:31:02 +0100 |
|---|---|---|
| committer | Vito Graffagnino <vito@graffagnino.xyz> | 2020-09-08 13:31:02 +0100 |
| commit | 8cc927e930d5b6aafe3e9862a61e81705479a1b4 (patch) | |
| tree | d9b75e65c2440ef0943c5598ccdddaf50a06ca44 /.zsh.d/_cht | |
Initial commit. .z* files added
Diffstat (limited to '.zsh.d/_cht')
| -rw-r--r-- | .zsh.d/_cht | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/.zsh.d/_cht b/.zsh.d/_cht new file mode 100644 index 0000000..e1a4230 --- /dev/null +++ b/.zsh.d/_cht @@ -0,0 +1,21 @@ +#compdef cht.sh + +__CHTSH_LANGS=($(curl -s cheat.sh/:list)) +_arguments -C \ + '--help[show this help message and exit]: :->noargs' \ + '--shell[enter shell repl]: :->noargs' \ + '1:Cheat Sheet:->lang' \ + '*::: :->noargs' && return 0 + +if [[ CURRENT -ge 1 ]]; then + case $state in + noargs) + _message "nothing to complete";; + lang) + compadd -X "Cheat Sheets" ${__CHTSH_LANGS[@]};; + *) + _message "Unknown state, error in autocomplete";; + esac + + return +fi |
