Merge pull request #84 from xPMo/zsh-completion

Support ZSH auto-completion
This commit is contained in:
Radovan Garabík 2018-04-28 19:17:00 +02:00 committed by GitHub
commit 59509cff15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 3 deletions

25
_grc Normal file
View 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

View File

@ -1,6 +1,4 @@
if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then
# Prevent grc aliases from overriding zsh completions.
setopt COMPLETE_ALIASES
# Supported commands
cmds=(

View File

@ -25,4 +25,5 @@ cp -fv grc.zsh $CONFDIR
cp -fv grc.fish $CONFDIR
mkdir -p $PROFILEDIR
cp -fv grc.bashrc $PROFILEDIR
mkdir -p $PREFIX/zsh/site-functions
cp -fv _grc $PREFIX/zsh/site-functions