#compdef steamguard

autoload -U is-at-least

_steamguard() {
    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[@]}" : \
'(-a --all)-u+[Steam username, case-sensitive.]:USERNAME: ' \
'(-a --all)--username=[Steam username, case-sensitive.]:USERNAME: ' \
'(-a --all)--password=[Steam account password. You really shouldn'\''t use this if you can avoid it.]:PASSWORD: ' \
'-m+[Specify which folder your maFiles are in. This should be a path to a folder that contains manifest.json. Default\: ~/.config/steamguard-cli/maFiles]:MAFILES_PATH: ' \
'--mafiles-path=[Specify which folder your maFiles are in. This should be a path to a folder that contains manifest.json. Default\: ~/.config/steamguard-cli/maFiles]:MAFILES_PATH: ' \
'-p+[Specify your encryption passkey.]:PASSKEY: ' \
'--passkey=[Specify your encryption passkey.]:PASSKEY: ' \
'-v+[Set the log level. Be warned, trace is capable of printing sensitive data.]:VERBOSITY:(error warn info debug trace)' \
'--verbosity=[Set the log level. Be warned, trace is capable of printing sensitive data.]:VERBOSITY:(error warn info debug trace)' \
'--http-proxy=[Use a proxy for HTTP requests.]:HTTP_PROXY: ' \
'--proxy-credentials=[Credentials to use for proxy authentication in the format username\:password.]:PROXY_CREDENTIALS: ' \
'(-u --username)-a[Select all accounts in the manifest.]' \
'(-u --username)--all[Select all accounts in the manifest.]' \
'--no-update-check[Disable checking for updates.]' \
'--danger-accept-invalid-certs[Accept invalid TLS certificates.]' \
'--offline[Assume the computer'\''s time is correct. Don'\''t ask Steam for the time when generating codes.]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_steamguard_commands" \
"*::: :->steamguard-cli" \
&& ret=0
    case $state in
    (steamguard-cli)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:steamguard-command-$line[1]:"
        case $line[1] in
            (approve)
_arguments "${_arguments_options[@]}" : \
'(--dangerously-approve-all)*--auto-approve-ip=[Automatically approve all login requests from the given IPv4 addresses non-interactively. Useful for CI/CD systems. Requests that don'\''t match will be ignored.]:AUTO_APPROVE_IP: ' \
'(--auto-approve-ip)--dangerously-approve-all[Blindly approve all pending login sessions without prompting.]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(debug)
_arguments "${_arguments_options[@]}" : \
'--print-stripped-json=[Read the specified file, parse it, strip values, and print the result.]:PRINT_STRIPPED_JSON: ' \
'--demo-prompt[Show a text prompt.]' \
'--demo-pause[Show a "press any key" prompt.]' \
'--demo-prompt-char[Show a character prompt.]' \
'--demo-conf-menu[Show an example confirmation menu using dummy data.]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
'-s+[The shell to generate completions for.]:SHELL:(bash elvish fish powershell zsh)' \
'--shell=[The shell to generate completions for.]:SHELL:(bash elvish fish powershell zsh)' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" : \
'*--files=[Paths to one or more maFiles, eg. "./gaben.maFile"]:FILES: ' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(confirm)
_arguments "${_arguments_options[@]}" : \
'-a[Accept all open mobile confirmations. Does not open interactive interface.]' \
'--accept-all[Accept all open mobile confirmations. Does not open interactive interface.]' \
'-f[If submitting a confirmation response fails, exit immediately.]' \
'--fail-fast[If submitting a confirmation response fails, exit immediately.]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(encrypt)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(decrypt)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(code)
_arguments "${_arguments_options[@]}" : \
'--offline[Assume the computer'\''s time is correct. Don'\''t ask Steam for the time when generating codes.]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(qr)
_arguments "${_arguments_options[@]}" : \
'--ascii[Force using ASCII chars to generate QR codes. Useful for terminals that don'\''t support unicode.]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(qr-login)
_arguments "${_arguments_options[@]}" : \
'--url=[The URL that would normally open in the Steam app. This is the URL that the QR code is displaying. It should start with \\"https\://s.team/...\\"]:URL: ' \
'--image=[Path to an image file containing the QR code. The QR code will be scanned from this image]:IMAGE:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
'--raw[Print raw protobuf response.]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_steamguard__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:steamguard-help-command-$line[1]:"
        case $line[1] in
            (approve)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(debug)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(confirm)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(encrypt)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(decrypt)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(code)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(qr)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(qr-login)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_steamguard_commands] )) ||
_steamguard_commands() {
    local commands; commands=(
'approve:Approve or deny pending login sessions' \
'debug:Debug stuff, not useful for most users.' \
'completion:Generate shell completions' \
'setup:Set up a new account with steamguard-cli' \
'import:Import an account with steamguard already set up. It must not be encrypted. If you haven'\''t used steamguard-cli before, you probably don'\''t need to use this command.' \
'confirm:Interactive interface for steam mobile confirmations' \
'remove:Remove the authenticator from an account.' \
'encrypt:Encrypt all maFiles' \
'decrypt:Decrypt all maFiles' \
'code:Generate 2FA codes' \
'qr:Generate QR codes. This *will* print sensitive data to stdout.' \
'qr-login:Log in to Steam on another device using the QR code that it'\''s displaying.' \
'status:Query and print the 2FA status of an account.' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'steamguard commands' commands "$@"
}
(( $+functions[_steamguard__approve_commands] )) ||
_steamguard__approve_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard approve commands' commands "$@"
}
(( $+functions[_steamguard__code_commands] )) ||
_steamguard__code_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard code commands' commands "$@"
}
(( $+functions[_steamguard__completion_commands] )) ||
_steamguard__completion_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard completion commands' commands "$@"
}
(( $+functions[_steamguard__confirm_commands] )) ||
_steamguard__confirm_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard confirm commands' commands "$@"
}
(( $+functions[_steamguard__debug_commands] )) ||
_steamguard__debug_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard debug commands' commands "$@"
}
(( $+functions[_steamguard__decrypt_commands] )) ||
_steamguard__decrypt_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard decrypt commands' commands "$@"
}
(( $+functions[_steamguard__encrypt_commands] )) ||
_steamguard__encrypt_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard encrypt commands' commands "$@"
}
(( $+functions[_steamguard__help_commands] )) ||
_steamguard__help_commands() {
    local commands; commands=(
'approve:Approve or deny pending login sessions' \
'debug:Debug stuff, not useful for most users.' \
'completion:Generate shell completions' \
'setup:Set up a new account with steamguard-cli' \
'import:Import an account with steamguard already set up. It must not be encrypted. If you haven'\''t used steamguard-cli before, you probably don'\''t need to use this command.' \
'confirm:Interactive interface for steam mobile confirmations' \
'remove:Remove the authenticator from an account.' \
'encrypt:Encrypt all maFiles' \
'decrypt:Decrypt all maFiles' \
'code:Generate 2FA codes' \
'qr:Generate QR codes. This *will* print sensitive data to stdout.' \
'qr-login:Log in to Steam on another device using the QR code that it'\''s displaying.' \
'status:Query and print the 2FA status of an account.' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'steamguard help commands' commands "$@"
}
(( $+functions[_steamguard__help__approve_commands] )) ||
_steamguard__help__approve_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help approve commands' commands "$@"
}
(( $+functions[_steamguard__help__code_commands] )) ||
_steamguard__help__code_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help code commands' commands "$@"
}
(( $+functions[_steamguard__help__completion_commands] )) ||
_steamguard__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help completion commands' commands "$@"
}
(( $+functions[_steamguard__help__confirm_commands] )) ||
_steamguard__help__confirm_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help confirm commands' commands "$@"
}
(( $+functions[_steamguard__help__debug_commands] )) ||
_steamguard__help__debug_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help debug commands' commands "$@"
}
(( $+functions[_steamguard__help__decrypt_commands] )) ||
_steamguard__help__decrypt_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help decrypt commands' commands "$@"
}
(( $+functions[_steamguard__help__encrypt_commands] )) ||
_steamguard__help__encrypt_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help encrypt commands' commands "$@"
}
(( $+functions[_steamguard__help__help_commands] )) ||
_steamguard__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help help commands' commands "$@"
}
(( $+functions[_steamguard__help__import_commands] )) ||
_steamguard__help__import_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help import commands' commands "$@"
}
(( $+functions[_steamguard__help__qr_commands] )) ||
_steamguard__help__qr_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help qr commands' commands "$@"
}
(( $+functions[_steamguard__help__qr-login_commands] )) ||
_steamguard__help__qr-login_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help qr-login commands' commands "$@"
}
(( $+functions[_steamguard__help__remove_commands] )) ||
_steamguard__help__remove_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help remove commands' commands "$@"
}
(( $+functions[_steamguard__help__setup_commands] )) ||
_steamguard__help__setup_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help setup commands' commands "$@"
}
(( $+functions[_steamguard__help__status_commands] )) ||
_steamguard__help__status_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard help status commands' commands "$@"
}
(( $+functions[_steamguard__import_commands] )) ||
_steamguard__import_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard import commands' commands "$@"
}
(( $+functions[_steamguard__qr_commands] )) ||
_steamguard__qr_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard qr commands' commands "$@"
}
(( $+functions[_steamguard__qr-login_commands] )) ||
_steamguard__qr-login_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard qr-login commands' commands "$@"
}
(( $+functions[_steamguard__remove_commands] )) ||
_steamguard__remove_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard remove commands' commands "$@"
}
(( $+functions[_steamguard__setup_commands] )) ||
_steamguard__setup_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard setup commands' commands "$@"
}
(( $+functions[_steamguard__status_commands] )) ||
_steamguard__status_commands() {
    local commands; commands=()
    _describe -t commands 'steamguard status commands' commands "$@"
}

if [ "$funcstack[1]" = "_steamguard" ]; then
    _steamguard "$@"
else
    compdef _steamguard steamguard
fi
