diff --git a/_grc b/_grc new file mode 100644 index 0000000..a94011f --- /dev/null +++ b/_grc @@ -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 --config=)'{-c+,--config=-}'[use 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 diff --git a/grc.zsh b/grc.zsh index 5a0c31c..0846ec3 100644 --- a/grc.zsh +++ b/grc.zsh @@ -1,6 +1,4 @@ if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then - # Prevent grc aliases from overriding zsh completions. - setopt COMPLETE_ALIASES # Supported commands cmds=( diff --git a/install.sh b/install.sh index 312d139..b715096 100755 --- a/install.sh +++ b/install.sh @@ -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