mirror of
https://github.com/garabik/grc.git
synced 2024-09-30 17:51:30 +02:00
Merge pull request #84 from xPMo/zsh-completion
Support ZSH auto-completion
This commit is contained in:
commit
59509cff15
25
_grc
Normal file
25
_grc
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#compdef grc
|
||||||
|
|
||||||
|
setopt localoptions extended_glob
|
||||||
|
|
||||||
|
local environ e cmd
|
||||||
|
local -a args
|
||||||
|
local -a _comp_priv_prefix
|
||||||
|
|
||||||
|
zstyle -a ":completion:${curcontext}:" environ environ
|
||||||
|
|
||||||
|
for e in "${environ[@]}"
|
||||||
|
do local -x "$e"
|
||||||
|
done
|
||||||
|
|
||||||
|
args=(
|
||||||
|
'(-e --stderr)'{-e,--stderr}'[redirect stderr; do not automatically redirect stdout]'
|
||||||
|
'(-s --stdout)'{-s,--stdout}'[redirect stdout; even with -e/--stderr]'
|
||||||
|
'(-c <name>--config=<name>)'{-c+,--config=-}'[use <name> as configuration file for grcat]:file:_files'
|
||||||
|
'--color=-[colo?urize output]:color:(on off auto)'
|
||||||
|
'(-h --help)'{-h,--help}'[display help message and exit]'
|
||||||
|
'--pty[run command in pseudotermnial (experimental)]'
|
||||||
|
'*::arguments:{ _normal }'
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments -s $args
|
2
grc.zsh
2
grc.zsh
@ -1,6 +1,4 @@
|
|||||||
if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then
|
if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then
|
||||||
# Prevent grc aliases from overriding zsh completions.
|
|
||||||
setopt COMPLETE_ALIASES
|
|
||||||
|
|
||||||
# Supported commands
|
# Supported commands
|
||||||
cmds=(
|
cmds=(
|
||||||
|
@ -25,4 +25,5 @@ cp -fv grc.zsh $CONFDIR
|
|||||||
cp -fv grc.fish $CONFDIR
|
cp -fv grc.fish $CONFDIR
|
||||||
mkdir -p $PROFILEDIR
|
mkdir -p $PROFILEDIR
|
||||||
cp -fv grc.bashrc $PROFILEDIR
|
cp -fv grc.bashrc $PROFILEDIR
|
||||||
|
mkdir -p $PREFIX/zsh/site-functions
|
||||||
|
cp -fv _grc $PREFIX/zsh/site-functions
|
||||||
|
Loading…
Reference in New Issue
Block a user