mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 15:30:15 +08:00
feat(grc): source grc.zsh
instead of hard-coding its content (#9553)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
parent
a4a79eaa8c
commit
0e7c81316c
@ -10,28 +10,6 @@ plugins=(... grc)
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
The following commands are wrapped by `grc` so that their output is automatically colored:
|
The plugin sources the bundled alias generator from the installation, available at `/etc/grc.zsh`.
|
||||||
|
The complete list of wrapped commands may vary depending on the installed version of `grc`, look
|
||||||
- `cc`
|
at the file mentioned above (`/etc/grc.zsh`) to see which commands are wrapped.
|
||||||
- `configure`
|
|
||||||
- `cvs`
|
|
||||||
- `df`
|
|
||||||
- `diff`
|
|
||||||
- `dig`
|
|
||||||
- `gcc`
|
|
||||||
- `gmake`
|
|
||||||
- `ifconfig`
|
|
||||||
- `iwconfig`
|
|
||||||
- `last`
|
|
||||||
- `ldap`
|
|
||||||
- `make`
|
|
||||||
- `mount`
|
|
||||||
- `mtr`
|
|
||||||
- `netstat`
|
|
||||||
- `ping`
|
|
||||||
- `ping6`
|
|
||||||
- `ps`
|
|
||||||
- `traceroute`
|
|
||||||
- `traceroute6`
|
|
||||||
- `wdiff`
|
|
||||||
- `whois`
|
|
||||||
|
@ -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
|
# common grc.zsh paths
|
||||||
return
|
files=(
|
||||||
fi
|
/etc/grc.zsh # default
|
||||||
|
/usr/local/etc/grc.zsh # homebrew
|
||||||
# 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
|
# verify the file is readable and source it
|
||||||
for cmd in $cmds; do
|
for file in $files; do
|
||||||
if (( $+commands[$cmd] )); then
|
if [[ -r "$file" ]]; then
|
||||||
eval "function $cmd {
|
source "$file"
|
||||||
grc --colour=auto \"${commands[$cmd]}\" \"\$@\"
|
break
|
||||||
}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Clean up variables
|
unset file files
|
||||||
unset cmds cmd
|
|
||||||
|
Loading…
Reference in New Issue
Block a user