Merge branch 'devel' of github.com:garabik/grc into devel

This commit is contained in:
Radovan Garabík 2020-12-28 17:07:40 +01:00
commit a31019fd81
2 changed files with 19 additions and 6 deletions

View File

@ -52,8 +52,8 @@ regexp=([\w/\.\-]+)(\[\d+?\])
colours=bold blue, bold red colours=bold blue, bold red
count=more count=more
====== ======
# IPv4 # IPv4 or IPv4:Port
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?
colours=bold yellow colours=bold yellow
count=more count=more
====== ======

21
grc.zsh
View File

@ -1,4 +1,7 @@
if [[ "$TERM" = dumb ]] || (( ! $+commands[grc] )); then #!/usr/bin/env zsh
if [ "$TERM" = dumb ] || (( ! $+commands[grc] ))
then
return return
fi fi
@ -9,6 +12,7 @@ cmds=(
blkid blkid
cc cc
configure configure
curl
cvs cvs
df df
diff diff
@ -71,19 +75,28 @@ cmds=(
traceroute traceroute
traceroute6 traceroute6
tune2fs tune2fs
ulimit
uptime uptime
vmstat vmstat
wdiff wdiff
whois 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. # Set alias for available commands.
for cmd in $cmds ; do for cmd in $cmds ; do
if (( $+commands[$cmd] )) ; then if (( $+commands[$cmd] )) ; then
alias $cmd="grc --colour=auto $commands[$cmd]" setup_alias $cmd
fi fi
done done
# Clean up variables # Clean up variables
unset cmds cmd unset cmds cmd setup_alias