#compdef sq-git

autoload -U is-at-least

_sq-git() {
    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[@]}" : \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
":: :_sq-git_commands" \
"*::: :->sq-git" \
&& ret=0
    case $state in
    (sq-git)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sq-git-command-$line[1]:"
        case $line[1] in
            (init)
_arguments "${_arguments_options[@]}" : \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(policy)
_arguments "${_arguments_options[@]}" : \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
":: :_sq-git__policy_commands" \
"*::: :->policy" \
&& ret=0

    case $state in
    (policy)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sq-git-policy-command-$line[1]:"
        case $line[1] in
            (describe)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'(--policy-file)--commit=[Describe the policy from the specified commit]:COMMIT:_default' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(diff)
_arguments "${_arguments_options[@]}" : \
'--old-commit=[The old policy as taken from the specified commit]:OLD_COMMIT:_default' \
'--old-file=[The old policy as taken from the specified file]:OLD_FILE:_files' \
'--new-commit=[The new policy as taken from the specified commit]:NEW_COMMIT:_default' \
'--new-file=[The new policy as taken from the specified file]:NEW_FILE:_files' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::old -- The old policy:_default' \
'::new -- The new policy:_default' \
&& ret=0
;;
(authorize)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'--cert=[The fingerprint or Key ID of the certificate to use]:FINGERPRINT|KEYID:_default' \
'--cert-file=[The file containing the certificate to authorize]:FILE:_files' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'--sign-commit[Grant the certificate the sign-commit capability]' \
'--no-sign-commit[Rescind the sign-commit capability from a certificate]' \
'--sign-tag[Grant the certificate the sign-tag capability]' \
'--no-sign-tag[Rescind the sign-tag capability from a certificate]' \
'--sign-archive[Grant the certificate the sign-archive capability]' \
'--no-sign-archive[Rescind the sign-archive capability from a certificate]' \
'--add-user[Grant the certificate the add-user capability]' \
'--no-add-user[Rescind the add-user capability from a certificate]' \
'--retire-user[Grants the certificate the retire-user capability]' \
'--no-retire-user[Rescind the retire-user capability from a certificate]' \
'--audit[Grants the certificate the audit capability]' \
'--no-audit[Rescind the audit capability from a certificate]' \
'--project-maintainer[Grants all capabilities relevant to a project maintainer]' \
'--release-manager[Grants all capabilities relevant to a release manager]' \
'--committer[Grants all capabilities relevant to a committer]' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':name:_default' \
'::value -- The filename, fingerprint or Key ID of the certificate to authenticate:_default' \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'(--policy-file)--commit=[Use the policy in the specified commit]:COMMIT:_default' \
'--name=[The name of the entity whose certificates should be exported]:NAME:_default' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'--all[Exports all of the certificates]' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(sync)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'*-s+[Looks for updates on the specified keyservers]:KEYSERVER:_default' \
'*--keyserver=[Looks for updates on the specified keyservers]:KEYSERVER:_default' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'--disable-keyservers[Don'\''t look for updates on any keyservers]' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(goodlist)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':commit:_default' \
&& ret=0
;;
        esac
    ;;
esac
;;
(log)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'--trust-root=[Specifies the trust root]:COMMIT:_default' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'--keep-going[Continues to check commits even when it is clear that the target commit cannot be authenticated]' \
'--prune-certs[After authenticating the current version, prunes the certificates]' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::commit_range -- The commits to check:_default' \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'--trust-root=[Read the policy from this commit]:COMMIT:_default' \
'--signature=[The signature to verify]:FILENAME:_files' \
'--archive=[The archive that the signature protects]:FILENAME:_files' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(update-hook)
_arguments "${_arguments_options[@]}" : \
'--policy-file=[Use an alternate policy]:POLICY:_files' \
'--trust-root=[The commit to use as a trust root]:COMMIT:_default' \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':ref_name -- The name of the ref being updated:_default' \
':old_object -- The old object name stored in the ref:_default' \
':new_object -- The new object name stored in the ref:_default' \
&& ret=0
;;
(version)
_arguments "${_arguments_options[@]}" : \
'--home=[Set the home directory]:PATH:_default' \
'--cert-store=[Specify the location of the certificate store]:PATH:_default' \
'--output-format=[Produces output in the specified format, if possible]:FORMAT:(human-readable json)' \
'-q[Shows less information]' \
'--quiet[Shows less information]' \
'(-q --quiet)-v[Shows more information]' \
'(-q --quiet)--verbose[Shows more information]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_sq-git__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sq-git-help-command-$line[1]:"
        case $line[1] in
            (init)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(policy)
_arguments "${_arguments_options[@]}" : \
":: :_sq-git__help__policy_commands" \
"*::: :->policy" \
&& ret=0

    case $state in
    (policy)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sq-git-help-policy-command-$line[1]:"
        case $line[1] in
            (describe)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(diff)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(authorize)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(sync)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(goodlist)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(log)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(update-hook)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(version)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_sq-git_commands] )) ||
_sq-git_commands() {
    local commands; commands=(
'init:Suggests how to create a policy' \
'policy:Describe, update, and change the OpenPGP policy' \
'log:Lists and verifies commits' \
'verify:Verifies signatures on archives like release tarballs' \
'update-hook:A \`git update hook\` that enforces the policy' \
'version:Detailed version and output version information' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'sq-git commands' commands "$@"
}
(( $+functions[_sq-git__help_commands] )) ||
_sq-git__help_commands() {
    local commands; commands=(
'init:Suggests how to create a policy' \
'policy:Describe, update, and change the OpenPGP policy' \
'log:Lists and verifies commits' \
'verify:Verifies signatures on archives like release tarballs' \
'update-hook:A \`git update hook\` that enforces the policy' \
'version:Detailed version and output version information' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'sq-git help commands' commands "$@"
}
(( $+functions[_sq-git__help__help_commands] )) ||
_sq-git__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help help commands' commands "$@"
}
(( $+functions[_sq-git__help__init_commands] )) ||
_sq-git__help__init_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help init commands' commands "$@"
}
(( $+functions[_sq-git__help__log_commands] )) ||
_sq-git__help__log_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help log commands' commands "$@"
}
(( $+functions[_sq-git__help__policy_commands] )) ||
_sq-git__help__policy_commands() {
    local commands; commands=(
'describe:Describes the policy' \
'diff:Shows changes between two policies' \
'authorize:Changes the authorizations' \
'export:Exports the certificates associated with an entity' \
'sync:Updates the OpenPGP certificates in the policy' \
'goodlist:Adds the given commit to the commit goodlist' \
    )
    _describe -t commands 'sq-git help policy commands' commands "$@"
}
(( $+functions[_sq-git__help__policy__authorize_commands] )) ||
_sq-git__help__policy__authorize_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help policy authorize commands' commands "$@"
}
(( $+functions[_sq-git__help__policy__describe_commands] )) ||
_sq-git__help__policy__describe_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help policy describe commands' commands "$@"
}
(( $+functions[_sq-git__help__policy__diff_commands] )) ||
_sq-git__help__policy__diff_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help policy diff commands' commands "$@"
}
(( $+functions[_sq-git__help__policy__export_commands] )) ||
_sq-git__help__policy__export_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help policy export commands' commands "$@"
}
(( $+functions[_sq-git__help__policy__goodlist_commands] )) ||
_sq-git__help__policy__goodlist_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help policy goodlist commands' commands "$@"
}
(( $+functions[_sq-git__help__policy__sync_commands] )) ||
_sq-git__help__policy__sync_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help policy sync commands' commands "$@"
}
(( $+functions[_sq-git__help__update-hook_commands] )) ||
_sq-git__help__update-hook_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help update-hook commands' commands "$@"
}
(( $+functions[_sq-git__help__verify_commands] )) ||
_sq-git__help__verify_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help verify commands' commands "$@"
}
(( $+functions[_sq-git__help__version_commands] )) ||
_sq-git__help__version_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git help version commands' commands "$@"
}
(( $+functions[_sq-git__init_commands] )) ||
_sq-git__init_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git init commands' commands "$@"
}
(( $+functions[_sq-git__log_commands] )) ||
_sq-git__log_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git log commands' commands "$@"
}
(( $+functions[_sq-git__policy_commands] )) ||
_sq-git__policy_commands() {
    local commands; commands=(
'describe:Describes the policy' \
'diff:Shows changes between two policies' \
'authorize:Changes the authorizations' \
'export:Exports the certificates associated with an entity' \
'sync:Updates the OpenPGP certificates in the policy' \
'goodlist:Adds the given commit to the commit goodlist' \
    )
    _describe -t commands 'sq-git policy commands' commands "$@"
}
(( $+functions[_sq-git__policy__authorize_commands] )) ||
_sq-git__policy__authorize_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git policy authorize commands' commands "$@"
}
(( $+functions[_sq-git__policy__describe_commands] )) ||
_sq-git__policy__describe_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git policy describe commands' commands "$@"
}
(( $+functions[_sq-git__policy__diff_commands] )) ||
_sq-git__policy__diff_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git policy diff commands' commands "$@"
}
(( $+functions[_sq-git__policy__export_commands] )) ||
_sq-git__policy__export_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git policy export commands' commands "$@"
}
(( $+functions[_sq-git__policy__goodlist_commands] )) ||
_sq-git__policy__goodlist_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git policy goodlist commands' commands "$@"
}
(( $+functions[_sq-git__policy__sync_commands] )) ||
_sq-git__policy__sync_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git policy sync commands' commands "$@"
}
(( $+functions[_sq-git__update-hook_commands] )) ||
_sq-git__update-hook_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git update-hook commands' commands "$@"
}
(( $+functions[_sq-git__verify_commands] )) ||
_sq-git__verify_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git verify commands' commands "$@"
}
(( $+functions[_sq-git__version_commands] )) ||
_sq-git__version_commands() {
    local commands; commands=()
    _describe -t commands 'sq-git version commands' commands "$@"
}

if [ "$funcstack[1]" = "_sq-git" ]; then
    _sq-git "$@"
else
    compdef _sq-git sq-git
fi
