clean up zsh syntax

This commit is contained in:
Radovan Garabík 2020-11-18 16:44:59 +01:00
parent 371f85a580
commit b16ae2647d
1 changed files with 87 additions and 86 deletions

25
grc.zsh
View File

@ -1,7 +1,9 @@
if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then
if [[ "$TERM" = dumb ]] || (( ! $+commands[grc] )); then
return
fi
# Supported commands
cmds=(
# Supported commands
cmds=(
as
ant
blkid
@ -60,6 +62,7 @@ if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then
semanage
sensors
showmount
sockstat
ss
stat
sysctl
@ -72,17 +75,15 @@ if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then
vmstat
wdiff
whois
sockstat
)
)
# Set alias for available commands.
for cmd in $cmds ; do
# Set alias for available commands.
for cmd in $cmds ; do
if (( $+commands[$cmd] )) ; then
alias $cmd="grc $(whence $cmd)"
alias $cmd="grc --colour=auto $commands[$cmd]"
fi
done
done
# Clean up variables
unset cmds cmd
fi
# Clean up variables
unset cmds cmd