#compdef libredefender

autoload -U is-at-least

_libredefender() {
    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[@]}" \
'-D+[]:DATA:_files' \
'--data=[]:DATA:_files' \
'-q[Only show warnings]' \
'--quiet[Only show warnings]' \
'*-v[More verbose logs]' \
'*--verbose[More verbose logs]' \
'-C[]' \
'--colors[]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_libredefender_commands" \
"*::: :->libredefender" \
&& ret=0
    case $state in
    (libredefender)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:libredefender-command-$line[1]:"
        case $line[1] in
            (scan)
_arguments "${_arguments_options[@]}" \
'-j+[Configure the number of scanning threads, defaults to number of cpu cores]:CONCURRENCY: ' \
'--concurrency=[Configure the number of scanning threads, defaults to number of cpu cores]:CONCURRENCY: ' \
'-D+[]:DATA:_files' \
'--data=[]:DATA:_files' \
'-q[Only show warnings]' \
'--quiet[Only show warnings]' \
'*-v[More verbose logs]' \
'*--verbose[More verbose logs]' \
'-C[]' \
'--colors[]' \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Paths that should be scanned:_files' \
&& ret=0
;;
(scheduler)
_arguments "${_arguments_options[@]}" \
'-D+[]:DATA:_files' \
'--data=[]:DATA:_files' \
'-q[Only show warnings]' \
'--quiet[Only show warnings]' \
'*-v[More verbose logs]' \
'*--verbose[More verbose logs]' \
'-C[]' \
'--colors[]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(infections)
_arguments "${_arguments_options[@]}" \
'-D+[]:DATA:_files' \
'--data=[]:DATA:_files' \
'-d[Interactively offer deletion for every file]' \
'--delete[Interactively offer deletion for every file]' \
'--delete-all[Delete all files without further confirmation (DANGER!)]' \
'-q[Only show warnings]' \
'--quiet[Only show warnings]' \
'*-v[More verbose logs]' \
'*--verbose[More verbose logs]' \
'-C[]' \
'--colors[]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(test-notify)
_arguments "${_arguments_options[@]}" \
'-D+[]:DATA:_files' \
'--data=[]:DATA:_files' \
'-q[Only show warnings]' \
'--quiet[Only show warnings]' \
'*-v[More verbose logs]' \
'*--verbose[More verbose logs]' \
'-C[]' \
'--colors[]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(dump-config)
_arguments "${_arguments_options[@]}" \
'-D+[]:DATA:_files' \
'--data=[]:DATA:_files' \
'-q[Only show warnings]' \
'--quiet[Only show warnings]' \
'*-v[More verbose logs]' \
'*--verbose[More verbose logs]' \
'-C[]' \
'--colors[]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-D+[]:DATA:_files' \
'--data=[]:DATA:_files' \
'-q[Only show warnings]' \
'--quiet[Only show warnings]' \
'*-v[More verbose logs]' \
'*--verbose[More verbose logs]' \
'-C[]' \
'--colors[]' \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_libredefender__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:libredefender-help-command-$line[1]:"
        case $line[1] in
            (scan)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(scheduler)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(infections)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(test-notify)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(dump-config)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_libredefender_commands] )) ||
_libredefender_commands() {
    local commands; commands=(
'scan:Scan directories for signature matches' \
'scheduler:Run a background service that scans periodically' \
'infections:List threats that have been detected' \
'test-notify:Send a test notification' \
'dump-config:Load the configuration and print it as json for debugging' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'libredefender commands' commands "$@"
}
(( $+functions[_libredefender__completions_commands] )) ||
_libredefender__completions_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender completions commands' commands "$@"
}
(( $+functions[_libredefender__help__completions_commands] )) ||
_libredefender__help__completions_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender help completions commands' commands "$@"
}
(( $+functions[_libredefender__dump-config_commands] )) ||
_libredefender__dump-config_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender dump-config commands' commands "$@"
}
(( $+functions[_libredefender__help__dump-config_commands] )) ||
_libredefender__help__dump-config_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender help dump-config commands' commands "$@"
}
(( $+functions[_libredefender__help_commands] )) ||
_libredefender__help_commands() {
    local commands; commands=(
'scan:Scan directories for signature matches' \
'scheduler:Run a background service that scans periodically' \
'infections:List threats that have been detected' \
'test-notify:Send a test notification' \
'dump-config:Load the configuration and print it as json for debugging' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'libredefender help commands' commands "$@"
}
(( $+functions[_libredefender__help__help_commands] )) ||
_libredefender__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender help help commands' commands "$@"
}
(( $+functions[_libredefender__help__infections_commands] )) ||
_libredefender__help__infections_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender help infections commands' commands "$@"
}
(( $+functions[_libredefender__infections_commands] )) ||
_libredefender__infections_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender infections commands' commands "$@"
}
(( $+functions[_libredefender__help__scan_commands] )) ||
_libredefender__help__scan_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender help scan commands' commands "$@"
}
(( $+functions[_libredefender__scan_commands] )) ||
_libredefender__scan_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender scan commands' commands "$@"
}
(( $+functions[_libredefender__help__scheduler_commands] )) ||
_libredefender__help__scheduler_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender help scheduler commands' commands "$@"
}
(( $+functions[_libredefender__scheduler_commands] )) ||
_libredefender__scheduler_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender scheduler commands' commands "$@"
}
(( $+functions[_libredefender__help__test-notify_commands] )) ||
_libredefender__help__test-notify_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender help test-notify commands' commands "$@"
}
(( $+functions[_libredefender__test-notify_commands] )) ||
_libredefender__test-notify_commands() {
    local commands; commands=()
    _describe -t commands 'libredefender test-notify commands' commands "$@"
}

if [ "$funcstack[1]" = "_libredefender" ]; then
    _libredefender "$@"
else
    compdef _libredefender libredefender
fi
