#compdef git-smash

autoload -U is-at-least

_git-smash() {
    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[@]}" \
'--format=[Git log format to pretty print the targets]' \
'-n+[Limit number of listed commits (0 for unlimited stream)]' \
'--max-count=[Limit number of listed commits (0 for unlimited stream)]' \
'--range=[Limit the listed commits to the given range]' \
'--list[List mode to print all potential targets to stdout]' \
'--select[Select mode to print final target to stdout]' \
'-a[List all revs including already published commits]' \
'--all[List all revs including already published commits]' \
'-l[Limit the listed revs to local commits]' \
'--local[Limit the listed revs to local commits]' \
'--rebase[Rebase the fixup commit into the target]' \
'--no-rebase[Do not rebase the fixup commit into the target]' \
'--interactive[Let the user edit the list of commits before rebasing]' \
'--blame[List commits acquired from blame chunks]' \
'--no-blame[Do not list commits acquired from blame chunks]' \
'--files[List commits acquired from history of changed files]' \
'--no-files[Do not list commits acquired from history of changed files]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_git-smash_commands" \
"*::: :->git-smash" \
&& ret=0
    case $state in
    (git-smash)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:git-smash-command-$line[1]:"
        case $line[1] in
            (completions)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':shell:(zsh bash fish powershell elvish)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_git-smash_commands] )) ||
_git-smash_commands() {
    local commands; commands=(
        "completions:Generate shell completions" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'git-smash commands' commands "$@"
}
(( $+functions[_git-smash__completions_commands] )) ||
_git-smash__completions_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'git-smash completions commands' commands "$@"
}
(( $+functions[_git-smash__help_commands] )) ||
_git-smash__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'git-smash help commands' commands "$@"
}

_git-smash "$@"