#compdef cargo-sonar

autoload -U is-at-least

_cargo-sonar() {
    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[@]}" : \
'--audit-path=[Path of the '\''cargo audit'\'' report]:AUDIT_PATH:_files' \
'--clippy-path=[Path of the '\''cargo clippy'\'' report]:CLIPPY_PATH:_files' \
'--deny-path=[Path of the '\''cargo deny'\'' report]:DENY_PATH:_files' \
'--outdated-path=[Path of the '\''cargo outdated'\'' report]:OUTDATED_PATH:_files' \
'--udeps-path=[Path of the '\''cargo udeps'\'' report]:UDEPS_PATH:_files' \
'--sonar-path=[Path to the generated sonar report]:SONAR_PATH:_files' \
'--codeclimate-path=[Path to the generated codeclimate report]:CODECLIMATE_PATH:_files' \
'--completion=[Generate completion rules for some shells]:COMPLETION:((bash\:"Bourne Again SHell (bash)"
elvish\:"Elvish shell"
fish\:"Friendly Interactive SHell (fish)"
nushell\:"Nushell"
power-shell\:"PowerShell"
zsh\:"Z SHell (zsh)"))' \
'--audit[Enable parsing of the '\''cargo audit'\'' report]' \
'--clippy[Enable parsing of the '\''cargo clippy'\'' report]' \
'--deny[Enable parsing of the '\''cargo deny'\'' report]' \
'--outdated[Enable parsing of the '\''cargo outdated'\'' report]' \
'--udeps[Enable parsing of the '\''cargo udeps'\'' report]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

(( $+functions[_cargo-sonar_commands] )) ||
_cargo-sonar_commands() {
    local commands; commands=()
    _describe -t commands 'cargo-sonar commands' commands "$@"
}

if [ "$funcstack[1]" = "_cargo-sonar" ]; then
    _cargo-sonar "$@"
else
    compdef _cargo-sonar cargo-sonar
fi
