mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-28 07:50:09 +08:00
feat(plugins): add grc plugin for Generic Colouriser (#9315)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
parent
e2f2489a66
commit
e5af22cca6
37
plugins/grc/README.md
Normal file
37
plugins/grc/README.md
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Generic Colouriser plugin
|
||||||
|
|
||||||
|
This plugin adds wrappers for commands supported by [Generic Colouriser](https://github.com/garabik/grc):
|
||||||
|
|
||||||
|
To use it, add `grc` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... grc)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
The following commands are wrapped by `grc` so that their output is automatically colored:
|
||||||
|
|
||||||
|
- `cc`
|
||||||
|
- `configure`
|
||||||
|
- `cvs`
|
||||||
|
- `df`
|
||||||
|
- `diff`
|
||||||
|
- `dig`
|
||||||
|
- `gcc`
|
||||||
|
- `gmake`
|
||||||
|
- `ifconfig`
|
||||||
|
- `iwconfig`
|
||||||
|
- `last`
|
||||||
|
- `ldap`
|
||||||
|
- `make`
|
||||||
|
- `mount`
|
||||||
|
- `mtr`
|
||||||
|
- `netstat`
|
||||||
|
- `ping`
|
||||||
|
- `ping6`
|
||||||
|
- `ps`
|
||||||
|
- `traceroute`
|
||||||
|
- `traceroute6`
|
||||||
|
- `wdiff`
|
||||||
|
- `whois`
|
44
plugins/grc/grc.plugin.zsh
Normal file
44
plugins/grc/grc.plugin.zsh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user