#compdef envio

autoload -U is-at-least

_envio() {
    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[@]}" \
'-h[Print help]' \
'--help[Print help]' \
":: :_envio_commands" \
"*::: :->envio" \
&& ret=0
    case $state in
    (envio)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:envio-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(load)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(unload)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(launch)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(version)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'*::args:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_envio__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:envio-help-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(load)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(unload)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(launch)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(version)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_envio_commands] )) ||
_envio_commands() {
    local commands; commands=(
'create:Create a new profile' \
'add:Add a new environment variable to a profile' \
'load:Load a profile in the current session' \
'unload:Unload a profile from the current session' \
'launch:Launch a program with a profile' \
'remove:Remove a environment variable from a profile' \
'list:List all the environment variables in a profile or all the profiles' \
'update:Update a environment variable in a profile' \
'export:Export a profile to a file if no file is specified it will be exported to a file named .env' \
'import:Import a profile from a file' \
'version:Print the version' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'envio commands' commands "$@"
}
(( $+functions[_envio__add_commands] )) ||
_envio__add_commands() {
    local commands; commands=()
    _describe -t commands 'envio add commands' commands "$@"
}
(( $+functions[_envio__help__add_commands] )) ||
_envio__help__add_commands() {
    local commands; commands=()
    _describe -t commands 'envio help add commands' commands "$@"
}
(( $+functions[_envio__create_commands] )) ||
_envio__create_commands() {
    local commands; commands=()
    _describe -t commands 'envio create commands' commands "$@"
}
(( $+functions[_envio__help__create_commands] )) ||
_envio__help__create_commands() {
    local commands; commands=()
    _describe -t commands 'envio help create commands' commands "$@"
}
(( $+functions[_envio__export_commands] )) ||
_envio__export_commands() {
    local commands; commands=()
    _describe -t commands 'envio export commands' commands "$@"
}
(( $+functions[_envio__help__export_commands] )) ||
_envio__help__export_commands() {
    local commands; commands=()
    _describe -t commands 'envio help export commands' commands "$@"
}
(( $+functions[_envio__help_commands] )) ||
_envio__help_commands() {
    local commands; commands=(
'create:Create a new profile' \
'add:Add a new environment variable to a profile' \
'load:Load a profile in the current session' \
'unload:Unload a profile from the current session' \
'launch:Launch a program with a profile' \
'remove:Remove a environment variable from a profile' \
'list:List all the environment variables in a profile or all the profiles' \
'update:Update a environment variable in a profile' \
'export:Export a profile to a file if no file is specified it will be exported to a file named .env' \
'import:Import a profile from a file' \
'version:Print the version' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'envio help commands' commands "$@"
}
(( $+functions[_envio__help__help_commands] )) ||
_envio__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'envio help help commands' commands "$@"
}
(( $+functions[_envio__help__import_commands] )) ||
_envio__help__import_commands() {
    local commands; commands=()
    _describe -t commands 'envio help import commands' commands "$@"
}
(( $+functions[_envio__import_commands] )) ||
_envio__import_commands() {
    local commands; commands=()
    _describe -t commands 'envio import commands' commands "$@"
}
(( $+functions[_envio__help__launch_commands] )) ||
_envio__help__launch_commands() {
    local commands; commands=()
    _describe -t commands 'envio help launch commands' commands "$@"
}
(( $+functions[_envio__launch_commands] )) ||
_envio__launch_commands() {
    local commands; commands=()
    _describe -t commands 'envio launch commands' commands "$@"
}
(( $+functions[_envio__help__list_commands] )) ||
_envio__help__list_commands() {
    local commands; commands=()
    _describe -t commands 'envio help list commands' commands "$@"
}
(( $+functions[_envio__list_commands] )) ||
_envio__list_commands() {
    local commands; commands=()
    _describe -t commands 'envio list commands' commands "$@"
}
(( $+functions[_envio__help__load_commands] )) ||
_envio__help__load_commands() {
    local commands; commands=()
    _describe -t commands 'envio help load commands' commands "$@"
}
(( $+functions[_envio__load_commands] )) ||
_envio__load_commands() {
    local commands; commands=()
    _describe -t commands 'envio load commands' commands "$@"
}
(( $+functions[_envio__help__remove_commands] )) ||
_envio__help__remove_commands() {
    local commands; commands=()
    _describe -t commands 'envio help remove commands' commands "$@"
}
(( $+functions[_envio__remove_commands] )) ||
_envio__remove_commands() {
    local commands; commands=()
    _describe -t commands 'envio remove commands' commands "$@"
}
(( $+functions[_envio__help__unload_commands] )) ||
_envio__help__unload_commands() {
    local commands; commands=()
    _describe -t commands 'envio help unload commands' commands "$@"
}
(( $+functions[_envio__unload_commands] )) ||
_envio__unload_commands() {
    local commands; commands=()
    _describe -t commands 'envio unload commands' commands "$@"
}
(( $+functions[_envio__help__update_commands] )) ||
_envio__help__update_commands() {
    local commands; commands=()
    _describe -t commands 'envio help update commands' commands "$@"
}
(( $+functions[_envio__update_commands] )) ||
_envio__update_commands() {
    local commands; commands=()
    _describe -t commands 'envio update commands' commands "$@"
}
(( $+functions[_envio__help__version_commands] )) ||
_envio__help__version_commands() {
    local commands; commands=()
    _describe -t commands 'envio help version commands' commands "$@"
}
(( $+functions[_envio__version_commands] )) ||
_envio__version_commands() {
    local commands; commands=()
    _describe -t commands 'envio version commands' commands "$@"
}

if [ "$funcstack[1]" = "_envio" ]; then
    _envio "$@"
else
    compdef _envio envio
fi
