]> arthur.barton.de Git - ax-zsh.git/commitdiff
New "cheat" default plugin
authorAlexander Barton <alex@barton.de>
Fri, 7 Jul 2017 19:58:19 +0000 (21:58 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 7 Jul 2017 19:58:19 +0000 (21:58 +0200)
This plugin implements a "cheat" function and uses http://cheat.sh
to download cheat sheet information. It supports curl(1) as well as
wget(1) and uses the "monokai" theme.

default_plugins/cheat/cheat.zshrc [new file with mode: 0644]

diff --git a/default_plugins/cheat/cheat.zshrc b/default_plugins/cheat/cheat.zshrc
new file mode 100644 (file)
index 0000000..c366032
--- /dev/null
@@ -0,0 +1,15 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# cheat: Setup http://cheat.sh
+
+function cheat() {
+       url="http://cheat.sh/$@?style=monokai"
+
+       if (( $+commands[curl] )); then
+               curl "$url"
+       elif (( $+commands[wget] )); then
+               wget -qO - "$url"
+       else
+               echo "Neither curl(1) nor wget(1) found!" >&2
+               return 1
+       fi
+}