diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2021-01-18 13:16:40 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2021-01-18 13:16:40 -0700 |
commit | c6e754a3119b7273a57f0cfed38e85303662d26b (patch) | |
tree | c50ae3c6b0271ec88e964d3a57199ea37e63bf0b /plugins/grc/grc.plugin.zsh | |
parent | fb45741fc1dbd40dd2be72bc35a28c6ee8f3f7a5 (diff) | |
parent | efcbd9f3480a28ec69c607c46adcbfd8d230ac9f (diff) | |
download | zsh-c6e754a3119b7273a57f0cfed38e85303662d26b.tar.gz zsh-c6e754a3119b7273a57f0cfed38e85303662d26b.tar.bz2 zsh-c6e754a3119b7273a57f0cfed38e85303662d26b.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/grc/grc.plugin.zsh')
-rw-r--r-- | plugins/grc/grc.plugin.zsh | 49 |
1 files changed, 11 insertions, 38 deletions
diff --git a/plugins/grc/grc.plugin.zsh b/plugins/grc/grc.plugin.zsh index 6a52ec568..b709b9e02 100644 --- a/plugins/grc/grc.plugin.zsh +++ b/plugins/grc/grc.plugin.zsh @@ -1,44 +1,17 @@ -# Adapted from: https://github.com/garabik/grc/blob/master/grc.zsh +#!/usr/bin/env zsh -if [[ "$TERM" = dumb ]] || (( ! $+commands[grc] )); then - return -fi - -# Supported commands -cmds=( - cc - configure - cvs - df - diff - dig - gcc - gmake - ifconfig - iwconfig - last - ldap - make - mount - mtr - netstat - ping - ping6 - ps - traceroute - traceroute6 - wdiff - whois +# common grc.zsh paths +files=( + /etc/grc.zsh # default + /usr/local/etc/grc.zsh # homebrew ) -# Set alias for supported commands -for cmd in $cmds; do - if (( $+commands[$cmd] )); then - eval "function $cmd { - grc --colour=auto \"${commands[$cmd]}\" \"\$@\" - }" +# verify the file is readable and source it +for file in $files; do + if [[ -r "$file" ]]; then + source "$file" + break fi done -# Clean up variables -unset cmds cmd +unset file files |