#compdef conceal

autoload -U is-at-least

_conceal() {
    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]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_conceal_commands" \
"*::: :->conceal" \
&& ret=0
    case $state in
    (conceal)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:conceal-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(restore)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(clean)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_conceal__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:conceal-help-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(restore)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(clean)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_conceal_commands] )) ||
_conceal_commands() {
    local commands; commands=(
'list:List all the discarded entities' \
'restore:Restore entities discarded under the current directory' \
'clean:Delete all the discarded entities permanently' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'conceal commands' commands "$@"
}
(( $+functions[_conceal__clean_commands] )) ||
_conceal__clean_commands() {
    local commands; commands=()
    _describe -t commands 'conceal clean commands' commands "$@"
}
(( $+functions[_conceal__help__clean_commands] )) ||
_conceal__help__clean_commands() {
    local commands; commands=()
    _describe -t commands 'conceal help clean commands' commands "$@"
}
(( $+functions[_conceal__help_commands] )) ||
_conceal__help_commands() {
    local commands; commands=(
'list:List all the discarded entities' \
'restore:Restore entities discarded under the current directory' \
'clean:Delete all the discarded entities permanently' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'conceal help commands' commands "$@"
}
(( $+functions[_conceal__help__help_commands] )) ||
_conceal__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'conceal help help commands' commands "$@"
}
(( $+functions[_conceal__help__list_commands] )) ||
_conceal__help__list_commands() {
    local commands; commands=()
    _describe -t commands 'conceal help list commands' commands "$@"
}
(( $+functions[_conceal__list_commands] )) ||
_conceal__list_commands() {
    local commands; commands=()
    _describe -t commands 'conceal list commands' commands "$@"
}
(( $+functions[_conceal__help__restore_commands] )) ||
_conceal__help__restore_commands() {
    local commands; commands=()
    _describe -t commands 'conceal help restore commands' commands "$@"
}
(( $+functions[_conceal__restore_commands] )) ||
_conceal__restore_commands() {
    local commands; commands=()
    _describe -t commands 'conceal restore commands' commands "$@"
}

if [ "$funcstack[1]" = "_conceal" ]; then
    _conceal "$@"
else
    compdef _conceal conceal
fi
