mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 01:17:24 +08:00
Compare commits
No commits in common. "0f6836701d82a2ee024153c7f781bb72c2e9a8ac" and "a4a79eaa8cdf39f35dcd1753b973e830ff7b00b8" have entirely different histories.
0f6836701d
...
a4a79eaa8c
@ -391,9 +391,7 @@ function _omz::update {
|
|||||||
|
|
||||||
# Restart the zsh session
|
# Restart the zsh session
|
||||||
if [[ $ret -eq 0 && "$1" != --unattended ]]; then
|
if [[ $ret -eq 0 && "$1" != --unattended ]]; then
|
||||||
# Old zsh versions don't have ZSH_ARGZERO
|
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
[[ "$ZSH_ARGZERO" = -* ]] && exec -l "${ZSH_ARGZERO#-}" || exec "$ZSH_ARGZERO"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,28 @@ plugins=(... grc)
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
The plugin sources the bundled alias generator from the installation, available at `/etc/grc.zsh`.
|
The following commands are wrapped by `grc` so that their output is automatically colored:
|
||||||
The complete list of wrapped commands may vary depending on the installed version of `grc`, look
|
|
||||||
at the file mentioned above (`/etc/grc.zsh`) to see which commands are wrapped.
|
- `cc`
|
||||||
|
- `configure`
|
||||||
|
- `cvs`
|
||||||
|
- `df`
|
||||||
|
- `diff`
|
||||||
|
- `dig`
|
||||||
|
- `gcc`
|
||||||
|
- `gmake`
|
||||||
|
- `ifconfig`
|
||||||
|
- `iwconfig`
|
||||||
|
- `last`
|
||||||
|
- `ldap`
|
||||||
|
- `make`
|
||||||
|
- `mount`
|
||||||
|
- `mtr`
|
||||||
|
- `netstat`
|
||||||
|
- `ping`
|
||||||
|
- `ping6`
|
||||||
|
- `ps`
|
||||||
|
- `traceroute`
|
||||||
|
- `traceroute6`
|
||||||
|
- `wdiff`
|
||||||
|
- `whois`
|
||||||
|
|||||||
@ -1,17 +1,44 @@
|
|||||||
#!/usr/bin/env zsh
|
# Adapted from: https://github.com/garabik/grc/blob/master/grc.zsh
|
||||||
|
|
||||||
# common grc.zsh paths
|
if [[ "$TERM" = dumb ]] || (( ! $+commands[grc] )); then
|
||||||
files=(
|
return
|
||||||
/etc/grc.zsh # default
|
fi
|
||||||
/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
|
||||||
)
|
)
|
||||||
|
|
||||||
# verify the file is readable and source it
|
# Set alias for supported commands
|
||||||
for file in $files; do
|
for cmd in $cmds; do
|
||||||
if [[ -r "$file" ]]; then
|
if (( $+commands[$cmd] )); then
|
||||||
source "$file"
|
eval "function $cmd {
|
||||||
break
|
grc --colour=auto \"${commands[$cmd]}\" \"\$@\"
|
||||||
|
}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
unset file files
|
# Clean up variables
|
||||||
|
unset cmds cmd
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user