mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01: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
2 changed files with 14 additions and 63 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue