mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 10:01:11 +02:00
47 lines
1.2 KiB
Text
47 lines
1.2 KiB
Text
#compdef env genv
|
|
|
|
local context state line variant args ret=1
|
|
|
|
_pick_variant -r variant gnu=Free\ Soft $OSTYPE --version
|
|
case $variant in
|
|
gnu)
|
|
args=(
|
|
'(-)'{-i,--ignore-environment}'[start with empty environment]'
|
|
'(--ignore-environment -i --help --version)*'{-u+,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
|
|
'(-C --chdir)'{-C+,--chdir=}'[change working directory]:directory:_directories'
|
|
'(- *)--help[display help information]'
|
|
'(- *)--version[display version information]'
|
|
)
|
|
;;
|
|
freebsd*)
|
|
args=(
|
|
'(-i)*-u[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
|
|
'-P[specify alternate executable search PATH]:path:_dir_list'
|
|
'-S[perform word splitting]'
|
|
'*-v[verbose output]'
|
|
)
|
|
;&
|
|
*)
|
|
if (( $words[(i)-] < CURRENT )); then
|
|
words[(i)-]=()
|
|
(( CURRENT-- ))
|
|
else
|
|
args+=(
|
|
'(-i)'{-,-i}'[start with empty environment]'
|
|
)
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
_arguments $args \
|
|
'*::arguments:->normal' && ret=0
|
|
|
|
if [[ -n $state ]]; then
|
|
while [[ $words[1] = *=* ]]; do
|
|
shift words
|
|
(( CURRENT-- ))
|
|
done
|
|
_normal && ret=0
|
|
fi
|
|
|
|
return ret
|