mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-13 22:28:25 +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
|
||||
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
|
||||
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
||||
[[ "$ZSH_ARGZERO" = -* ]] && exec -l "${ZSH_ARGZERO#-}" || exec "$ZSH_ARGZERO"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -10,6 +10,28 @@ plugins=(... grc)
|
||||
|
||||
## Commands
|
||||
|
||||
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
|
||||
at the file mentioned above (`/etc/grc.zsh`) to see which commands are wrapped.
|
||||
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`
|
||||
|
||||
@ -1,17 +1,44 @@
|
||||
#!/usr/bin/env zsh
|
||||
# Adapted from: https://github.com/garabik/grc/blob/master/grc.zsh
|
||||
|
||||
# common grc.zsh paths
|
||||
files=(
|
||||
/etc/grc.zsh # default
|
||||
/usr/local/etc/grc.zsh # homebrew
|
||||
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
|
||||
)
|
||||
|
||||
# verify the file is readable and source it
|
||||
for file in $files; do
|
||||
if [[ -r "$file" ]]; then
|
||||
source "$file"
|
||||
break
|
||||
# Set alias for supported commands
|
||||
for cmd in $cmds; do
|
||||
if (( $+commands[$cmd] )); then
|
||||
eval "function $cmd {
|
||||
grc --colour=auto \"${commands[$cmd]}\" \"\$@\"
|
||||
}"
|
||||
fi
|
||||
done
|
||||
|
||||
unset file files
|
||||
# Clean up variables
|
||||
unset cmds cmd
|
||||
|
||||
Loading…
Reference in New Issue
Block a user