#compdef zizmor

autoload -U is-at-least

_zizmor() {
    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[@]}" : \
'*--collect=[Control which kinds of inputs are collected for auditing]:KIND:((all\:"Collect all possible inputs, ignoring \`.gitignore\` files"
default\:"Collect all possible inputs, respecting \`.gitignore\` files"
workflows\:"Collect workflows"
actions\:"Collect action definitions (i.e. \`action.yml\`)"
dependabot\:"Collect Dependabot configuration files (i.e. \`dependabot.yml\`)"))' \
'--fix=[Fix findings automatically, when available (EXPERIMENTAL)]::MODE:((safe\:"Apply only safe fixes (the default)"
unsafe-only\:"Apply only unsafe fixes"
all\:"Apply all fixes, both safe and unsafe"))' \
'--persona=[The persona to use while auditing]:PERSONA:((auditor\:"The "auditor" persona (false positives OK)"
pedantic\:"The "pedantic" persona (code smells OK)"
regular\:"The "regular" persona (minimal false positives)"))' \
'--min-severity=[Filter all results below this severity]:LEVEL:(informational low medium high)' \
'--min-confidence=[Filter all results below this confidence]:LEVEL:(low medium high)' \
'--format=[The output format to emit. By default, cargo-style diagnostics will be emitted]:KIND:((plain\:"cargo-style output"
json\:"JSON-formatted output (currently v1)"
json-v1\:""v1" JSON format"
sarif\:"SARIF-formatted output"
github\:"GitHub Actions workflow command-formatted output"))' \
'--color=[Control the use of color in output]:WHEN:((auto\:"Use color output if the output supports it"
always\:"Force color output, even if the output isn'\''t a terminal"
never\:"Disable color output, even if the output is a compatible terminal"))' \
'--render-links=[Whether to render OSC 8 links in the output]:WHEN:((auto\:"Render OSC 8 links in output if support is detected"
always\:"Always render OSC 8 links in output"
never\:"Never render OSC 8 links in output"))' \
'--show-audit-urls=[Whether to render audit URLs in the output, separately from any URLs embedded in OSC 8 links]:WHEN:((auto\:"Render audit URLs in output automatically based on output format and runtime context"
always\:"Always render audit URLs in output"
never\:"Never render audit URLs in output"))' \
'--gh-token=[The GitHub API token to use \[env\: GH_TOKEN or GITHUB_TOKEN or ZIZMOR_GITHUB_TOKEN\]]:GH_TOKEN:_default' \
'--github-token=[This is an alias for \`--gh-token\` / \`GH_TOKEN\`]:GITHUB_TOKEN:_default' \
'--zizmor-github-token=[This is an alias for \`--gh-token\` / \`GH_TOKEN\` / \`--github-token\` / \`GITHUB_TOKEN\`]:ZIZMOR_GITHUB_TOKEN:_default' \
'--gh-hostname=[The GitHub Server Hostname. Defaults to github.com]:GH_HOSTNAME:_default' \
'--cache-dir=[The directory to use for HTTP caching. By default, a host-appropriate user-caching directory will be used]:DIR:_files -/' \
'-c+[The configuration file to load. This loads a single configuration file across all input groups, which may not be what you intend]:FILE:_files' \
'--config=[The configuration file to load. This loads a single configuration file across all input groups, which may not be what you intend]:FILE:_files' \
'--completions=[Generate tab completion scripts for the specified shell]:SHELL:((bash\:"Bourne Again \`SHell\` (bash)"
elvish\:"Elvish shell"
fish\:"Friendly Interactive \`SHell\` (fish)"
nushell\:"Nushell"
powershell\:"\`PowerShell\`"
zsh\:"Z \`SHell\` (zsh)"))' \
'--strict-collection[Fail instead of warning on syntax and schema errors in collected inputs]' \
'-p[Emit '\''pedantic'\'' findings]' \
'--pedantic[Emit '\''pedantic'\'' findings]' \
'--no-ignores[Don'\''t honor ignore comments or ignore rules in configuration]' \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'--no-progress[Don'\''t show progress bars, even if the terminal supports them]' \
'--no-exit-codes[Disable all error codes besides success and tool failure]' \
'--naches[Enable naches mode]' \
'-o[Perform only offline operations]' \
'--offline[Perform only offline operations]' \
'--no-online-audits[Perform only offline audits]' \
'--lsp[Run in language server mode (EXPERIMENTAL)]' \
'--stdio[]' \
'--no-config[Disable all configuration loading]' \
'--thanks[Emit thank-you messages for zizmor'\''s sponsors]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'*::inputs -- The inputs to audit:_default' \
&& ret=0
}

(( $+functions[_zizmor_commands] )) ||
_zizmor_commands() {
    local commands; commands=()
    _describe -t commands 'zizmor commands' commands "$@"
}

if [ "$funcstack[1]" = "_zizmor" ]; then
    _zizmor "$@"
else
    compdef _zizmor zizmor
fi
