From 714c5a24fc3666137bdf39649b1688b1ed0ca176 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Mon, 5 Jul 2021 10:43:25 -0500 Subject: feat: added cheet.sh --- cheat.sh/shell/_cht | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cheat.sh/shell/_cht (limited to 'cheat.sh/shell/_cht') diff --git a/cheat.sh/shell/_cht b/cheat.sh/shell/_cht new file mode 100644 index 0000000..e1a4230 --- /dev/null +++ b/cheat.sh/shell/_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 -- cgit v1.2.3-70-g09d2