From c9480fca498673a58b376d413c11ee2821615547 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 7 Jul 2017 21:58:19 +0200 Subject: [PATCH] New "cheat" default plugin 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 default_plugins/cheat/cheat.zshrc diff --git a/default_plugins/cheat/cheat.zshrc b/default_plugins/cheat/cheat.zshrc new file mode 100644 index 0000000..c366032 --- /dev/null +++ b/default_plugins/cheat/cheat.zshrc @@ -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 +} -- 2.39.2