#compdef authoscope

autoload -U is-at-least

_authoscope() {
    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[@]}" : \
'-n+[Concurrent workers]:WORKERS:_default' \
'--workers=[Concurrent workers]:WORKERS:_default' \
'-o+[Write results to file]:OUTPUT:_default' \
'--output=[Write results to file]:OUTPUT:_default' \
'*-v[Verbose output]' \
'*--verbose[Verbose output]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_authoscope_commands" \
"*::: :->authoscope" \
&& ret=0
    case $state in
    (authoscope)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:authoscope-command-$line[1]:"
        case $line[1] in
            (dict)
_arguments "${_arguments_options[@]}" : \
'*-v[Verbose output]' \
'*--verbose[Verbose output]' \
'-h[Print help]' \
'--help[Print help]' \
':users_path -- Username list path:_files' \
':passwords_path -- Password list path:_files' \
'*::scripts -- Scripts to run:_default' \
&& ret=0
;;
(combo)
_arguments "${_arguments_options[@]}" : \
'*-v[Verbose output]' \
'*--verbose[Verbose output]' \
'-h[Print help]' \
'--help[Print help]' \
':path -- Path to combolist:_files' \
'*::scripts -- Scripts to run:_default' \
&& ret=0
;;
(enum)
_arguments "${_arguments_options[@]}" : \
'*-v[Verbose output]' \
'*--verbose[Verbose output]' \
'-h[Print help]' \
'--help[Print help]' \
':users -- Username list path:_default' \
'*::scripts -- Scripts to run:_default' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
'-x[Set the exitcode to 2 if the credentials are invalid]' \
'--exitcode[Set the exitcode to 2 if the credentials are invalid]' \
'*-v[Verbose output]' \
'*--verbose[Verbose output]' \
'-h[Print help]' \
'--help[Print help]' \
':script -- Script to run:_default' \
':user -- Username to test:_default' \
'::password -- Password to test:_default' \
&& ret=0
;;
(fsck)
_arguments "${_arguments_options[@]}" : \
'-q[Do not show invalid lines]' \
'--quiet[Do not show invalid lines]' \
'-s[Do not show valid lines]' \
'--silent[Do not show valid lines]' \
'-c[Require one colon per line]' \
'--colon[Require one colon per line]' \
'*-v[Verbose output]' \
'*--verbose[Verbose output]' \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Files to read:_default' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" : \
'*-v[Verbose output]' \
'*--verbose[Verbose output]' \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_authoscope__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:authoscope-help-command-$line[1]:"
        case $line[1] in
            (dict)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(combo)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(enum)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(fsck)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_authoscope_commands] )) ||
_authoscope_commands() {
    local commands; commands=(
'dict:For each user try every password from a dictionary/wordlist' \
'combo:Run a credential stuffing attack with a combolist' \
'enum:For each user enumerate if an account exists with that name/email' \
'run:Run a script with a single username and password' \
'fsck:Verify a given input file is properly encoded and all entries have valid formatting' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'authoscope commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__combo_commands] )) ||
_authoscope__subcmd__combo_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope combo commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__completions_commands] )) ||
_authoscope__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope completions commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__dict_commands] )) ||
_authoscope__subcmd__dict_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope dict commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__enum_commands] )) ||
_authoscope__subcmd__enum_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope enum commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__fsck_commands] )) ||
_authoscope__subcmd__fsck_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope fsck commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help_commands] )) ||
_authoscope__subcmd__help_commands() {
    local commands; commands=(
'dict:For each user try every password from a dictionary/wordlist' \
'combo:Run a credential stuffing attack with a combolist' \
'enum:For each user enumerate if an account exists with that name/email' \
'run:Run a script with a single username and password' \
'fsck:Verify a given input file is properly encoded and all entries have valid formatting' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'authoscope help commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help__subcmd__combo_commands] )) ||
_authoscope__subcmd__help__subcmd__combo_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope help combo commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help__subcmd__completions_commands] )) ||
_authoscope__subcmd__help__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope help completions commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help__subcmd__dict_commands] )) ||
_authoscope__subcmd__help__subcmd__dict_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope help dict commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help__subcmd__enum_commands] )) ||
_authoscope__subcmd__help__subcmd__enum_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope help enum commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help__subcmd__fsck_commands] )) ||
_authoscope__subcmd__help__subcmd__fsck_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope help fsck commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help__subcmd__help_commands] )) ||
_authoscope__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope help help commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__help__subcmd__run_commands] )) ||
_authoscope__subcmd__help__subcmd__run_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope help run commands' commands "$@"
}
(( $+functions[_authoscope__subcmd__run_commands] )) ||
_authoscope__subcmd__run_commands() {
    local commands; commands=()
    _describe -t commands 'authoscope run commands' commands "$@"
}

if [ "$funcstack[1]" = "_authoscope" ]; then
    _authoscope "$@"
else
    compdef _authoscope authoscope
fi
