#compdef hf

autoload -U is-at-least

_hf() {
    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[@]}" : \
'--log-level=[The minimum log level to print]:LEVEL:((OFF\:"Lowest log level"
ERROR\:"Error log level"
WARN\:"Warn log level"
INFO\:"Info log level"
DEBUG\:"Debug log level"
TRACE\:"Trace log level"))' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_hf_commands" \
"*::: :->hf" \
&& ret=0
    case $state in
    (hf)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:hf-command-$line[1]:"
        case $line[1] in
            (hide)
_arguments "${_arguments_options[@]}" : \
'--log-level=[The minimum log level to print]:LEVEL:((OFF\:"Lowest log level"
ERROR\:"Error log level"
WARN\:"Warn log level"
INFO\:"Info log level"
DEBUG\:"Debug log level"
TRACE\:"Trace log level"))' \
'-f[Actually hide files and directories]' \
'--force[Actually hide files and directories]' \
'-n[Don'\''t actually hide anything, just show what would be done]' \
'--dry-run[Don'\''t actually hide anything, just show what would be done]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'*::file -- Files and directories to hide:_files' \
&& ret=0
;;
(show)
_arguments "${_arguments_options[@]}" : \
'--log-level=[The minimum log level to print]:LEVEL:((OFF\:"Lowest log level"
ERROR\:"Error log level"
WARN\:"Warn log level"
INFO\:"Info log level"
DEBUG\:"Debug log level"
TRACE\:"Trace log level"))' \
'-f[Actually show hidden files and directories]' \
'--force[Actually show hidden files and directories]' \
'-n[Don'\''t actually show anything, just show what would be done]' \
'--dry-run[Don'\''t actually show anything, just show what would be done]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'*::file -- Hidden files and directories to show:_files' \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
'--log-level=[The minimum log level to print]:LEVEL:((OFF\:"Lowest log level"
ERROR\:"Error log level"
WARN\:"Warn log level"
INFO\:"Info log level"
DEBUG\:"Debug log level"
TRACE\:"Trace log level"))' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
':shell -- Shell to generate completion for:((bash\:"Bash"
elvish\:"Elvish"
fish\:"fish"
nushell\:"Nushell"
powershell\:"PowerShell"
zsh\:"Zsh"))' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_hf__help_commands" \
"*::: :->help" \
&& ret=0

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

(( $+functions[_hf_commands] )) ||
_hf_commands() {
    local commands; commands=(
'hide:Make files and directories invisible' \
'show:Make hidden files and directories visible' \
'completion:Generate shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'hf commands' commands "$@"
}
(( $+functions[_hf__completion_commands] )) ||
_hf__completion_commands() {
    local commands; commands=()
    _describe -t commands 'hf completion commands' commands "$@"
}
(( $+functions[_hf__help_commands] )) ||
_hf__help_commands() {
    local commands; commands=(
'hide:Make files and directories invisible' \
'show:Make hidden files and directories visible' \
'completion:Generate shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'hf help commands' commands "$@"
}
(( $+functions[_hf__help__completion_commands] )) ||
_hf__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'hf help completion commands' commands "$@"
}
(( $+functions[_hf__help__help_commands] )) ||
_hf__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'hf help help commands' commands "$@"
}
(( $+functions[_hf__help__hide_commands] )) ||
_hf__help__hide_commands() {
    local commands; commands=()
    _describe -t commands 'hf help hide commands' commands "$@"
}
(( $+functions[_hf__help__show_commands] )) ||
_hf__help__show_commands() {
    local commands; commands=()
    _describe -t commands 'hf help show commands' commands "$@"
}
(( $+functions[_hf__hide_commands] )) ||
_hf__hide_commands() {
    local commands; commands=()
    _describe -t commands 'hf hide commands' commands "$@"
}
(( $+functions[_hf__show_commands] )) ||
_hf__show_commands() {
    local commands; commands=()
    _describe -t commands 'hf show commands' commands "$@"
}

if [ "$funcstack[1]" = "_hf" ]; then
    _hf "$@"
else
    compdef _hf hf
fi
