#compdef omnidiff

autoload -U is-at-least

_omnidiff() {
    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[@]}" : \
'--mode=[How to show the diff. \`headless\` and \`json\` need BEFORE and AFTER. \`headless\` is also chosen when stdout is not a terminal; \`json\` never is]:MODE:((tui\:"The interactive viewer"
headless\:"Plain text on stdout"
json\:"One JSON object on stdout, for editor integrations"))' \
'--color=[When to ANSI-color headless output. \`auto\` colors unless \`NO_COLOR\` is set, even when stdout is a pipe (git'\''s pager shows color); \`always\` and \`never\` override \`NO_COLOR\`]:WHEN:(auto always never)' \
'--context=[Unchanged lines to keep around each change in headless output, like \`diff -U N\`]:N:_default' \
'--tui-tick-rate=[The TUI'\''s tick rate, in ticks per second]:FLOAT:_default' \
'--tui-frame-rate=[The TUI'\''s frame rate, in frames per second]:FLOAT:_default' \
'(--mode)--headless[Shorthand for \`--mode headless\`. \`--batch\` is a synonym]' \
'(--full)--minimal[Paint only the ranges that carry meaning\: every option of the TUI'\''s \`M\` panel off (its Minimal preset), so standalone brackets and separators, leading whitespace, and moves that only reindent or resize go unpainted. Without this or \`--full\`, the panel'\''s last saved setting applies; either one applies to this run only and is not saved]' \
'--full[Paint the fullest reading\: every option of the \`M\` panel on except whole-pair updates (its Full preset)]' \
'--whole-updates[Highlight an updated node'\''s matched pair whole (e.g. both \`argument\` and \`i_am_an_argument\`), instead of only the part that differs]' \
'--paint-reindent-moves[Paint a node as moved even when it only changed indentation (nesting added or removed around untouched content) - the \`M\` panel'\''s "Paint reindent-only moves" row, forced on]' \
'--exit-code[Exit 1 when the files differ (0 when identical, 2 on error) - the \`diff(1)\` convention, for scripts and CI conditionals. Headless and JSON modes only]' \
'(--headless --mode)--review[Open on the git review picker - the repository around the current directory'\''s unstaged files, staged files and recent commits - instead of an empty viewer (the \`G\` key, at startup). TUI only; takes no BEFORE/AFTER pair]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::paths -- The files to diff\: `BEFORE AFTER`, or git'\''s 7- or 9-argument `GIT_EXTERNAL_DIFF` list (`path old-file old-hex old-mode new-file new-hex new-mode \[new-path score\]`). Without them the viewer starts empty:_files' \
":: :_omnidiff_commands" \
"*::: :->omnidiff" \
&& ret=0
    case $state in
    (omnidiff)
        words=($line[2] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-command-$line[2]:"
        case $line[2] in
            (git)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_omnidiff__subcmd__git_commands" \
"*::: :->git" \
&& ret=0

    case $state in
    (git)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-git-command-$line[1]:"
        case $line[1] in
            (configure)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_omnidiff__subcmd__git__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-git-help-command-$line[1]:"
        case $line[1] in
            (configure)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(jj)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_omnidiff__subcmd__jj_commands" \
"*::: :->jj" \
&& ret=0

    case $state in
    (jj)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-jj-command-$line[1]:"
        case $line[1] in
            (configure)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_omnidiff__subcmd__jj__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-jj-help-command-$line[1]:"
        case $line[1] in
            (configure)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(util)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_omnidiff__subcmd__util_commands" \
"*::: :->util" \
&& ret=0

    case $state in
    (util)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-util-command-$line[1]:"
        case $line[1] in
            (completions)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':shell -- The shell to generate for:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(man)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(graphics)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_omnidiff__subcmd__util__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-util-help-command-$line[1]:"
        case $line[1] in
            (completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(man)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(graphics)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_omnidiff__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-help-command-$line[1]:"
        case $line[1] in
            (git)
_arguments "${_arguments_options[@]}" : \
":: :_omnidiff__subcmd__help__subcmd__git_commands" \
"*::: :->git" \
&& ret=0

    case $state in
    (git)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-help-git-command-$line[1]:"
        case $line[1] in
            (configure)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(jj)
_arguments "${_arguments_options[@]}" : \
":: :_omnidiff__subcmd__help__subcmd__jj_commands" \
"*::: :->jj" \
&& ret=0

    case $state in
    (jj)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-help-jj-command-$line[1]:"
        case $line[1] in
            (configure)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(util)
_arguments "${_arguments_options[@]}" : \
":: :_omnidiff__subcmd__help__subcmd__util_commands" \
"*::: :->util" \
&& ret=0

    case $state in
    (util)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:omnidiff-help-util-command-$line[1]:"
        case $line[1] in
            (completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(man)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(graphics)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_omnidiff_commands] )) ||
_omnidiff_commands() {
    local commands; commands=(
'git:git integration helpers' \
'jj:Jujutsu (jj) integration helpers' \
'util:Generate packaging artifacts (shell completions, man page)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__git_commands] )) ||
_omnidiff__subcmd__git_commands() {
    local commands; commands=(
'configure:Interactively configure omnidiff as git'\''s diff tool' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff git commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__git__subcmd__configure_commands] )) ||
_omnidiff__subcmd__git__subcmd__configure_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff git configure commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__git__subcmd__help_commands] )) ||
_omnidiff__subcmd__git__subcmd__help_commands() {
    local commands; commands=(
'configure:Interactively configure omnidiff as git'\''s diff tool' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff git help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__git__subcmd__help__subcmd__configure_commands] )) ||
_omnidiff__subcmd__git__subcmd__help__subcmd__configure_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff git help configure commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__git__subcmd__help__subcmd__help_commands] )) ||
_omnidiff__subcmd__git__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff git help help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help_commands] )) ||
_omnidiff__subcmd__help_commands() {
    local commands; commands=(
'git:git integration helpers' \
'jj:Jujutsu (jj) integration helpers' \
'util:Generate packaging artifacts (shell completions, man page)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__git_commands] )) ||
_omnidiff__subcmd__help__subcmd__git_commands() {
    local commands; commands=(
'configure:Interactively configure omnidiff as git'\''s diff tool' \
    )
    _describe -t commands 'omnidiff help git commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__git__subcmd__configure_commands] )) ||
_omnidiff__subcmd__help__subcmd__git__subcmd__configure_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff help git configure commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__help_commands] )) ||
_omnidiff__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff help help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__jj_commands] )) ||
_omnidiff__subcmd__help__subcmd__jj_commands() {
    local commands; commands=(
'configure:Interactively configure omnidiff as jj'\''s diff tool' \
    )
    _describe -t commands 'omnidiff help jj commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__jj__subcmd__configure_commands] )) ||
_omnidiff__subcmd__help__subcmd__jj__subcmd__configure_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff help jj configure commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__util_commands] )) ||
_omnidiff__subcmd__help__subcmd__util_commands() {
    local commands; commands=(
'completions:Print a shell completion script for SHELL on stdout' \
'man:Print a roff-formatted man page (section 1) on stdout' \
'graphics:Print how the picture view would draw in this terminal - \`kitty\`, \`sixel\`, \`iterm2\` or \`halfblocks\` - and why. Asks the terminal as the TUI does, so run it where the TUI would run. \`OMNIDIFF_GRAPHICS\` overrides the detection' \
    )
    _describe -t commands 'omnidiff help util commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__util__subcmd__completions_commands] )) ||
_omnidiff__subcmd__help__subcmd__util__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff help util completions commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__util__subcmd__graphics_commands] )) ||
_omnidiff__subcmd__help__subcmd__util__subcmd__graphics_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff help util graphics commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__help__subcmd__util__subcmd__man_commands] )) ||
_omnidiff__subcmd__help__subcmd__util__subcmd__man_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff help util man commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__jj_commands] )) ||
_omnidiff__subcmd__jj_commands() {
    local commands; commands=(
'configure:Interactively configure omnidiff as jj'\''s diff tool' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff jj commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__jj__subcmd__configure_commands] )) ||
_omnidiff__subcmd__jj__subcmd__configure_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff jj configure commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__jj__subcmd__help_commands] )) ||
_omnidiff__subcmd__jj__subcmd__help_commands() {
    local commands; commands=(
'configure:Interactively configure omnidiff as jj'\''s diff tool' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff jj help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__jj__subcmd__help__subcmd__configure_commands] )) ||
_omnidiff__subcmd__jj__subcmd__help__subcmd__configure_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff jj help configure commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__jj__subcmd__help__subcmd__help_commands] )) ||
_omnidiff__subcmd__jj__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff jj help help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util_commands] )) ||
_omnidiff__subcmd__util_commands() {
    local commands; commands=(
'completions:Print a shell completion script for SHELL on stdout' \
'man:Print a roff-formatted man page (section 1) on stdout' \
'graphics:Print how the picture view would draw in this terminal - \`kitty\`, \`sixel\`, \`iterm2\` or \`halfblocks\` - and why. Asks the terminal as the TUI does, so run it where the TUI would run. \`OMNIDIFF_GRAPHICS\` overrides the detection' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff util commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__completions_commands] )) ||
_omnidiff__subcmd__util__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff util completions commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__graphics_commands] )) ||
_omnidiff__subcmd__util__subcmd__graphics_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff util graphics commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__help_commands] )) ||
_omnidiff__subcmd__util__subcmd__help_commands() {
    local commands; commands=(
'completions:Print a shell completion script for SHELL on stdout' \
'man:Print a roff-formatted man page (section 1) on stdout' \
'graphics:Print how the picture view would draw in this terminal - \`kitty\`, \`sixel\`, \`iterm2\` or \`halfblocks\` - and why. Asks the terminal as the TUI does, so run it where the TUI would run. \`OMNIDIFF_GRAPHICS\` overrides the detection' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'omnidiff util help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__help__subcmd__completions_commands] )) ||
_omnidiff__subcmd__util__subcmd__help__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff util help completions commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__help__subcmd__graphics_commands] )) ||
_omnidiff__subcmd__util__subcmd__help__subcmd__graphics_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff util help graphics commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__help__subcmd__help_commands] )) ||
_omnidiff__subcmd__util__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff util help help commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__help__subcmd__man_commands] )) ||
_omnidiff__subcmd__util__subcmd__help__subcmd__man_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff util help man commands' commands "$@"
}
(( $+functions[_omnidiff__subcmd__util__subcmd__man_commands] )) ||
_omnidiff__subcmd__util__subcmd__man_commands() {
    local commands; commands=()
    _describe -t commands 'omnidiff util man commands' commands "$@"
}

if [ "$funcstack[1]" = "_omnidiff" ]; then
    _omnidiff "$@"
else
    compdef _omnidiff omnidiff
fi
