diff options
author | Mark Mercado <mamercad@gmail.com> | 2020-12-09 11:59:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 17:59:12 +0100 |
commit | e5af22cca6a07c9be52fe48810faaa08261e4d15 (patch) | |
tree | 9dfa3b7c92ca4d49e8025b895def582513c6feb6 /plugins/grc/grc.plugin.zsh | |
parent | e2f2489a666caf238804783b4e8851a781ac6ffc (diff) | |
download | zsh-e5af22cca6a07c9be52fe48810faaa08261e4d15.tar.gz zsh-e5af22cca6a07c9be52fe48810faaa08261e4d15.tar.bz2 zsh-e5af22cca6a07c9be52fe48810faaa08261e4d15.zip |
feat(plugins): add grc plugin for Generic Colouriser (#9315)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
Diffstat (limited to 'plugins/grc/grc.plugin.zsh')
-rw-r--r-- | plugins/grc/grc.plugin.zsh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/grc/grc.plugin.zsh b/plugins/grc/grc.plugin.zsh new file mode 100644 index 000000000..6a52ec568 --- /dev/null +++ b/plugins/grc/grc.plugin.zsh @@ -0,0 +1,44 @@ +# Adapted from: https://github.com/garabik/grc/blob/master/grc.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 +) + +# Set alias for supported commands +for cmd in $cmds; do + if (( $+commands[$cmd] )); then + eval "function $cmd { + grc --colour=auto \"${commands[$cmd]}\" \"\$@\" + }" + fi +done + +# Clean up variables +unset cmds cmd |