#compdef uu-env

autoload -U is-at-least

_uu-env() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" \
'-C+[change working directory to DIR]:DIR:_files -/' \
'--chdir=[change working directory to DIR]:DIR:_files -/' \
'*-f+[read and set variables from a ".env"-style configuration file (prior to any unset and/or set)]:PATH:_files' \
'*--file=[read and set variables from a ".env"-style configuration file (prior to any unset and/or set)]:PATH:_files' \
'*-u+[remove variable from the environment]:NAME: ' \
'*--unset=[remove variable from the environment]:NAME: ' \
'-i[start with an empty environment]' \
'--ignore-environment[start with an empty environment]' \
'-0[end each output line with a 0 byte rather than a newline (only valid when printing the environment)]' \
'--null[end each output line with a 0 byte rather than a newline (only valid when printing the environment)]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::vars:' \
&& ret=0
}

(( $+functions[_uu-env_commands] )) ||
_uu-env_commands() {
    local commands; commands=()
    _describe -t commands 'uu-env commands' commands "$@"
}

if [ "$funcstack[1]" = "_uu-env" ]; then
    _uu-env "$@"
else
    compdef _uu-env uu-env
fi
