#compdef b4

# AUTOMATICALLY GENERATED by `shtab`


_shtab_b4_commands() {
  local _commands=(
    "am:"
    "diff:"
    "kr:"
    "mbox:"
    "pr:"
    "prep:"
    "send:"
    "shazam:"
    "trailers:"
    "ty:"
  )
  _describe 'b4 commands' _commands
}

_shtab_b4_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "(- : *)--version[show program\'s version number and exit]"
  {-d,--debug}"[Add more debugging info to the output (default\: False)]"
  {-q,--quiet}"[Output critical information only (default\: False)]"
  {-n,--no-interactive}"[Do not ask any interactive questions (default\: False)]"
  "--offline-mode[Do not perform any network queries (default\: False)]"
  "--no-stdin[Disable TTY detection for stdin (default\: False)]"
  {-c,--config}"[Set config option NAME to VALUE. Override value
                        from config files. NAME is in dotted section.key
                        format. Using NAME\= and omitting VALUE will set the
                        value to the empty string. Using NAME and omitting
                        \=VALUE will set the value to \"true\". (default\: None)]:config:"
)

_shtab_b4_am_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-m,--use-local-mbox}"[Instead of grabbing a thread from lore, process this mbox file (or - for stdin) (default\: None)]:localmbox:"
  "--stdin-pipe-sep[When accepting messages on stdin, split using this pipe separator string (default\: None)]:stdin_pipe_sep:"
  {-C,--no-cache}"[Do not use local cache (default\: False)]"
  "--single-message[Only retrieve the message matching the msgid and ignore the rest of the thread (default\: False)]"
  {-o,--outdir}"[Output into this directory (or use - to output mailbox contents to stdout) (default\: .)]:outdir:"
  {-c,--check-newer-revisions}"[Check if newer patch revisions exist (default\: False)]"
  {-n,--mbox-name}"[Filename to name the mbox destination (default\: None)]:wantname:"
  {-M,--save-as-maildir}"[Save as maildir (avoids mbox format ambiguities) (default\: False)]"
  {-v,--use-version}"[Get a specific version of the patch\/series (default\: None)]:wantver:"
  {-t,--apply-cover-trailers}"[(This is now the default behavior\; this option will be removed in the future.) (default\: False)]"
  {-S,--sloppy-trailers}"[Apply trailers without email address match checking (default\: False)]"
  {-T,--no-add-trailers}"[Do not add any trailers from follow-up messages (default\: False)]"
  {-s,--add-my-sob}"[Add your own signed-off-by to every patch (default\: False)]"
  {-P,--cherry-pick}"[Cherry-pick a subset of patches (e.g. \"-P 1-2,4,6-\", \"-P _\" to use just the msgid specified, or \"-P \*globbing\*\" to match on commit subject) (default\: None)]:cherrypick:"
  {-k,--check}"[Run local checks for every patch (e.g. checkpatch) (default\: False)]"
  "--cc-trailers[Copy all Cc\'d addresses into Cc\: trailers (default\: False)]"
  "--no-parent[Break thread at the msgid specified and ignore any parent messages (default\: False)]"
  "--allow-unicode-control-chars[Allow unicode control characters (very rarely legitimate) (default\: False)]"
  {-l,--add-link}"[Add a Link\: trailer with message-id lookup URL to every patch (default\: False)]"
  {-i,--add-message-id}"[Add a Message-ID\: trailer to every patch (default\: False)]"
  {-Q,--quilt-ready}"[Save patches in a quilt-ready folder (default\: False)]"
  {-g,--guess-base}"[Try to guess the base of the series (if not specified) (default\: False)]"
  "*"{-b,--guess-branch}"[When guessing base, restrict to this branch (use with -g) (default\: None)]:guessbranch:"
  "--guess-lookback[When guessing base, go back this many days from the patch date (default\: 2 weeks) (default\: 21)]:guessdays:"
  {-3,--prep-3way}"[Prepare for a 3-way merge (tries to ensure that all index blobs exist by making a fake commit range) (default\: False)]"
  "--no-cover[Do not save the cover letter (on by default when using -o -) (default\: False)]"
  "--no-partial-reroll[Do not reroll partial series when detected (default\: False)]"
  ":Message ID to process, or pipe a raw message (default\: None):"
)

_shtab_b4_diff_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-g,--gitdir}"[Operate on this git tree instead of current dir (default\: None)]:gitdir:"
  {-C,--no-cache}"[Do not use local cache (default\: False)]"
  {-v,--compare-versions}"[Compare specific versions instead of latest and one before that, e.g. -v 3 5 (default\: None)]:wantvers:"
  {-n,--no-diff}"[Do not generate a diff, just show the command to do it (default\: False)]"
  {-o,--output-diff}"[Save diff into this file instead of outputting to stdout (default\: None)]:outdiff:"
  {-c,--color}"[Force color output even when writing to file (default\: False)]"
  {-m,--compare-am-mboxes}"[Compare two mbx files prepared with \"b4 am\" (default\: None)]:ambox:"
  ":Message ID to process, or pipe a raw message (default\: None):"
)

_shtab_b4_kr_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-m,--use-local-mbox}"[Instead of grabbing a thread from lore, process this mbox file (or - for stdin) (default\: None)]:localmbox:"
  "--stdin-pipe-sep[When accepting messages on stdin, split using this pipe separator string (default\: None)]:stdin_pipe_sep:"
  {-C,--no-cache}"[Do not use local cache (default\: False)]"
  "--single-message[Only retrieve the message matching the msgid and ignore the rest of the thread (default\: False)]"
  "--show-keys[Show all developer keys found in a thread (default\: False)]"
  ":Message ID to process, or pipe a raw message (default\: None):"
)

_shtab_b4_mbox_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-m,--use-local-mbox}"[Instead of grabbing a thread from lore, process this mbox file (or - for stdin) (default\: None)]:localmbox:"
  "--stdin-pipe-sep[When accepting messages on stdin, split using this pipe separator string (default\: None)]:stdin_pipe_sep:"
  {-C,--no-cache}"[Do not use local cache (default\: False)]"
  "--single-message[Only retrieve the message matching the msgid and ignore the rest of the thread (default\: False)]"
  {-o,--outdir}"[Output into this directory (or use - to output mailbox contents to stdout) (default\: .)]:outdir:"
  {-c,--check-newer-revisions}"[Check if newer patch revisions exist (default\: False)]"
  {-n,--mbox-name}"[Filename to name the mbox destination (default\: None)]:wantname:"
  {-M,--save-as-maildir}"[Save as maildir (avoids mbox format ambiguities) (default\: False)]"
  {-f,--filter-dupes}"[When adding messages to existing maildir, filter out duplicates (default\: False)]"
  {-r,--refetch}"[Refetch all messages in specified mbox with their original headers (default\: False)]:refetch:"
  "--minimize[Attempt to generate a minimal thread to simplify review. (default\: False)]"
  ":Message ID to process, or pipe a raw message (default\: None):"
)

_shtab_b4_pr_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-g,--gitdir}"[Operate on this git tree instead of current dir (default\: None)]:gitdir:"
  {-b,--branch}"[Check out FETCH_HEAD into this branch after fetching (default\: None)]:branch:"
  {-c,--check}"[Check if pull request has already been applied (default\: False)]"
  {-e,--explode}"[Convert a pull request into an mbox full of patches (default\: False)]"
  {-o,--output-mbox}"[Save exploded messages into this mailbox (default\: msgid.mbx) (default\: None)]:outmbox:"
  {-f,--from-addr}"[Use this From\: in exploded messages (use with -e) (default\: None)]:mailfrom:"
  {-s,--send-as-identity}"[Use git-send-email to send exploded series (use with -e)\;the identity must match a \[sendemail \"identity\"\] config section (default\: None)]:sendidentity:"
  "--dry-run[Force a --dry-run on git-send-email invocation (use with -s) (default\: False)]"
  ":Message ID to process, or pipe a raw message (default\: None):"
)

_shtab_b4_prep_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-c,--auto-to-cc}"[Automatically populate cover letter trailers with To and Cc addresses (default\: False)]"
  "--force-revision[Force revision to be this number instead (default\: None)]:force_revision:"
  "--set-prefixes[Prefixes to include after \[PATCH\] (e.g.\: RFC mydrv) (default\: None)]:set_prefixes:"
  "--add-prefixes[Additional prefixes to add to those already defined (default\: None)]:add_prefixes:"
  {-C,--no-cache}"[Do not use local cache when performing remote queries (default\: False)]"
  {-p,--format-patch}"[Output prep-tracked commits as patches (default\: None)]:format_patch:"
  "--edit-cover[Edit the cover letter in your defined \$EDITOR (or core.editor) (default\: False)]"
  "--edit-deps[Edit the series dependencies in your defined \$EDITOR (or core.editor) (default\: False)]"
  "--check-deps[Run checks for any defined series dependencies (default\: False)]"
  "--check[Run checks on the series (default\: False)]"
  "--show-revision[Show current series revision number (default\: False)]"
  "--compare-to[Display a range-diff to previously sent revision N (default\: None)]:compare_to:"
  "--manual-reroll[Mark current revision as sent and reroll (requires cover letter msgid) (default\: None)]:reroll:"
  "--show-info[Show series info in a format that can be passed to other commands. (default\: None)]:show_info:"
  "--cleanup[Archive and remove a prep-tracked branch and all its sent\/ tags (default\: None)]:cleanup:"
  {-n,--new}"[Create a new branch for working on a patch series (default\: None)]:new_series_name:"
  {-f,--fork-point}"[When creating a new branch, use this fork point instead of HEAD (default\: None)]:fork_point:"
  {-F,--from-thread}"[When creating a new branch, use this thread (default\: None)]:msgid:"
  {-e,--enroll}"[Enroll current branch, using its configured upstream branch as fork base, or the passed tag, branch, or commit (default\: None)]:enroll_base:"
)

_shtab_b4_send_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-d,--dry-run}"[Do not send, just dump out raw smtp messages to the stdout (default\: False)]"
  {-o,--output-dir}"[Do not send, write raw messages to this directory (forces --dry-run) (default\: None)]:output_dir:"
  "--preview-to[Send everything for a pre-review to specified addresses instead of actual recipients (default\: None)]:preview_to:"
  "--reflect[Send everything to yourself instead of the actual recipients (default\: False)]"
  "--no-trailer-to-cc[Do not add any addresses found in the cover or patch trailers to To\: or Cc\: (default\: False)]"
  "--to[Addresses to add to the To\: list (default\: None)]:to:"
  "--cc[Addresses to add to the Cc\: list (default\: None)]:cc:"
  "--not-me-too[Remove yourself from the To\: or Cc\: list (default\: False)]"
  "--resend[Resend a previously sent version of the series (default\: None)]:resend:"
  "--no-sign[Do not add the cryptographic attestation signature header (default\: False)]"
  "--use-web-endpoint[Force going through the web endpoint (default\: False)]"
  "--web-auth-new[Initiate a new web authentication request (default\: False)]"
  "--web-auth-verify[Submit the token received via verification email (default\: None)]:auth_verify:"
)

_shtab_b4_shazam_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-m,--use-local-mbox}"[Instead of grabbing a thread from lore, process this mbox file (or - for stdin) (default\: None)]:localmbox:"
  "--stdin-pipe-sep[When accepting messages on stdin, split using this pipe separator string (default\: None)]:stdin_pipe_sep:"
  {-C,--no-cache}"[Do not use local cache (default\: False)]"
  "--single-message[Only retrieve the message matching the msgid and ignore the rest of the thread (default\: False)]"
  {-v,--use-version}"[Get a specific version of the patch\/series (default\: None)]:wantver:"
  {-t,--apply-cover-trailers}"[(This is now the default behavior\; this option will be removed in the future.) (default\: False)]"
  {-S,--sloppy-trailers}"[Apply trailers without email address match checking (default\: False)]"
  {-T,--no-add-trailers}"[Do not add any trailers from follow-up messages (default\: False)]"
  {-s,--add-my-sob}"[Add your own signed-off-by to every patch (default\: False)]"
  {-P,--cherry-pick}"[Cherry-pick a subset of patches (e.g. \"-P 1-2,4,6-\", \"-P _\" to use just the msgid specified, or \"-P \*globbing\*\" to match on commit subject) (default\: None)]:cherrypick:"
  {-k,--check}"[Run local checks for every patch (e.g. checkpatch) (default\: False)]"
  "--cc-trailers[Copy all Cc\'d addresses into Cc\: trailers (default\: False)]"
  "--no-parent[Break thread at the msgid specified and ignore any parent messages (default\: False)]"
  "--allow-unicode-control-chars[Allow unicode control characters (very rarely legitimate) (default\: False)]"
  {-l,--add-link}"[Add a Link\: trailer with message-id lookup URL to every patch (default\: False)]"
  {-i,--add-message-id}"[Add a Message-ID\: trailer to every patch (default\: False)]"
  {-H,--make-fetch-head}"[Attempt to treat series as a pull request and fetch it into FETCH_HEAD (default\: False)]"
  {-M,--merge}"[Attempt to merge series as if it were a pull request (execs git-merge) (default\: False)]"
  "--guess-lookback[(use with -H or -M) When guessing base, go back this many days from the patch date (default\: 3 weeks) (default\: 21)]:guessdays:"
  "--merge-base[(use with -H or -M) Force this base when merging (default\: None)]:mergebase:"
  ":Message ID to process, or pipe a raw message (default\: None):"
)

_shtab_b4_trailers_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-u,--update}"[Update branch commits with latest received trailers (default\: False)]"
  {-S,--sloppy-trailers}"[Apply trailers without email address match checking (default\: False)]"
  {-F,--trailers-from}"[Look for trailers in the thread with this msgid instead of using the series change-id (default\: None)]:trailers_from:"
  "--since[The --since option to use with git-log when auto-matching patches (default\=1.month) (default\: 1.month)]:since:"
  "--since-commit[Look for any new trailers for commits starting with this one (default\: None)]:since_commit:"
  {-m,--use-local-mbox}"[Instead of grabbing a thread from lore, process this mbox file (or - for stdin) (default\: None)]:localmbox:"
  "--stdin-pipe-sep[When accepting messages on stdin, split using this pipe separator string (default\: None)]:stdin_pipe_sep:"
  {-C,--no-cache}"[Do not use local cache (default\: False)]"
  "--single-message[Only retrieve the message matching the msgid and ignore the rest of the thread (default\: False)]"
  ":Message ID to process, or pipe a raw message (default\: None):"
)

_shtab_b4_ty_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  {-g,--gitdir}"[Operate on this git tree instead of current dir (default\: None)]:gitdir:"
  {-o,--outdir}"[Write thanks files into this dir (default\=.) (default\: .)]:outdir:"
  {-l,--list}"[List pull requests and patch series you have retrieved (default\: False)]"
  {-t,--thank-for}"[Generate thankyous for specific entries from -l (e.g.\: 1,3-5,7-\; or \"all\") (default\: None)]:thankfor:"
  {-d,--discard}"[Discard specific messages from -l (e.g.\: 1,3-5,7-\; or \"all\") (default\: None)]:discard:"
  {-a,--auto}"[Use the Auto-Thankanator to figure out what got applied\/merged (default\: False)]"
  {-b,--branch}"[The branch to check against, instead of current (default\: None)]:branch:"
  "--since[The --since option to use when auto-matching patches (default\=1.week) (default\: 1.week)]:since:"
  {-S,--send-email}"[Send email instead of writing out .thanks files (default\: False)]"
  "--dry-run[Print out emails instead of sending them (default\: False)]"
  "--pw-set-state[Set this patchwork state instead of default (use with -a, -t or -d) (default\: None)]:pw_set_state:"
)


_shtab_b4() {
  local context state line curcontext="$curcontext" one_or_more='(-)*' remainder='(*)'

  if ((${_shtab_b4_options[(I)${(q)one_or_more}*]} + ${_shtab_b4_options[(I)${(q)remainder}*]} == 0)); then  # noqa: E501
    _shtab_b4_options+=(': :_shtab_b4_commands' '*::: :->b4')
  fi
  _arguments -C -s $_shtab_b4_options

  case $state in
    b4)
      words=($line[1] "${words[@]}")
      (( CURRENT += 1 ))
      curcontext="${curcontext%:*:*}:_shtab_b4-$line[1]:"
      case $line[1] in
        am) _arguments -C -s $_shtab_b4_am_options ;;
        diff) _arguments -C -s $_shtab_b4_diff_options ;;
        kr) _arguments -C -s $_shtab_b4_kr_options ;;
        mbox) _arguments -C -s $_shtab_b4_mbox_options ;;
        pr) _arguments -C -s $_shtab_b4_pr_options ;;
        prep) _arguments -C -s $_shtab_b4_prep_options ;;
        send) _arguments -C -s $_shtab_b4_send_options ;;
        shazam) _arguments -C -s $_shtab_b4_shazam_options ;;
        trailers) _arguments -C -s $_shtab_b4_trailers_options ;;
        ty) _arguments -C -s $_shtab_b4_ty_options ;;
      esac
  esac
}



typeset -A opt_args

if [[ $zsh_eval_context[-1] == eval ]]; then
  # eval/source/. command, register function for later
  compdef _shtab_b4 -N b4
else
  # autoload from fpath, call function directly
  _shtab_b4 "$@"
fi

