From 043d8355a937b6418782bdb7a197ffa2e5c6cb06 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 3 Feb 2019 14:33:25 +0100 Subject: [PATCH] cheat: Don't shadow real command (if any), and use pagination --- default_plugins/cheat/cheat.zshrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/default_plugins/cheat/cheat.zshrc b/default_plugins/cheat/cheat.zshrc index c366032..bfec747 100644 --- a/default_plugins/cheat/cheat.zshrc +++ b/default_plugins/cheat/cheat.zshrc @@ -1,13 +1,16 @@ # AX-ZSH: Alex' Modular ZSH Configuration # cheat: Setup http://cheat.sh +# Don't overwrite a real "cheat" command! +(( $+commands[cheat] )) && return + function cheat() { url="http://cheat.sh/$@?style=monokai" if (( $+commands[curl] )); then - curl "$url" + curl -s "$url" | ${PAGER:-less} elif (( $+commands[wget] )); then - wget -qO - "$url" + wget -qO - "$url" | ${PAGER:-less} else echo "Neither curl(1) nor wget(1) found!" >&2 return 1 -- 2.39.2