From: Alexander Barton Date: Sun, 3 Feb 2019 13:33:25 +0000 (+0100) Subject: cheat: Don't shadow real command (if any), and use pagination X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ax-zsh.git;a=commitdiff_plain;h=043d8355a937b6418782bdb7a197ffa2e5c6cb06 cheat: Don't shadow real command (if any), and use pagination --- 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