aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xcheat.sh/install7
-rw-r--r--cheat.sh/shell/_cht21
-rw-r--r--cheat.sh/uninstall3
-rw-r--r--install.conf.yaml1
4 files changed, 32 insertions, 0 deletions
diff --git a/cheat.sh/install b/cheat.sh/install
new file mode 100755
index 0000000..aa0b9ec
--- /dev/null
+++ b/cheat.sh/install
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+if [ ! "$(which cht.sh)" ]; then
+ mkdir -p ~/.local/bin
+ curl https://cht.sh/:cht.sh >~/.local/bin/cht.sh
+ chmod +x ~/.local/bin/cht.sh
+fi
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
diff --git a/cheat.sh/uninstall b/cheat.sh/uninstall
new file mode 100644
index 0000000..bff08cd
--- /dev/null
+++ b/cheat.sh/uninstall
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+rm ~/.local/bin/cht.sh
diff --git a/install.conf.yaml b/install.conf.yaml
index 51a486d..0dc3427 100644
--- a/install.conf.yaml
+++ b/install.conf.yaml
@@ -10,6 +10,7 @@
- [git submodule update --init --recursive, Installing submodules]
- [yes | ./fzf/install --bin, Installing fzf]
- [./bat/install bat, Installing bat]
+ - [./cheat.sh/install, Installing cheat.sh]
- link:
~/.bashrc: