Merge pull request #173 from hjpotter92/update/aliases

Changes as per review.
This commit is contained in:
Radovan Garabík 2020-12-29 16:16:18 +01:00 committed by GitHub
commit 357e686aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 12 deletions

17
grc.zsh
View File

@ -2,7 +2,7 @@
if [ "$TERM" = dumb ] || (( ! $+commands[grc] ))
then
return
return
fi
# Supported commands
@ -82,21 +82,14 @@ cmds=(
whois
)
function setup_alias() {
local name="$1"
local path="$(which "$name")"
$name() {
grc --colour=auto $commands[$0] "$@"
}
compdef "_${name}" "$name"
}
# Set alias for available commands.
for cmd in $cmds ; do
if (( $+commands[$cmd] )) ; then
setup_alias $cmd
$cmd() {
grc --colour=auto ${commands[$0]} "$@"
}
fi
done
# Clean up variables
unset cmds cmd setup_alias
unset cmds cmd