Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
0e7c8131
Unverified
Commit
0e7c8131
authored
Dec 31, 2020
by
hjpotter92
Committed by
GitHub
Dec 31, 2020
Browse files
feat(grc): source `grc.zsh` instead of hard-coding its content (#9553)
Co-authored-by:
Marc Cornellà
<
marc.cornella@live.com
>
parent
a4a79eaa
Changes
2
Show whitespace changes
Inline
Side-by-side
plugins/grc/README.md
View file @
0e7c8131
...
...
@@ -10,28 +10,6 @@ plugins=(... grc)
## Commands
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`
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.
plugins/grc/grc.plugin.zsh
View file @
0e7c8131
#
Adapted from: https://github.com/garabik/grc/blob/master/grc.
zsh
#
!/usr/bin/env
zsh
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
# common grc.zsh paths
files
=(
/etc/grc.zsh
# default
/usr/local/etc/grc.zsh
# homebrew
)
# Set alias for supported commands
for
cmd
in
$cmds
;
do
if
((
$+
commands[
$cmd
]
))
;
then
eval
"function
$cmd
{
grc --colour=auto
\"
${
commands
[
$cmd
]
}
\"
\"\$
@
\"
}"
# verify the file is readable and source it
for
file
in
$files
;
do
if
[[
-r
"
$file
"
]]
;
then
source
"
$file
"
break
fi
done
# Clean up variables
unset
cmds cmd
unset
file files
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment