Completion Commands
Tab completion for bash, zsh, fish, and PowerShell. bb completion install
sets up bash, zsh, or fish for you; bb completion <shell> prints the script
so you can load it yourself, and is the way to get PowerShell completion.
Global options: every global flag is accepted here (see
Global Flags). Only --json, --no-color and
--no-unicode change anything; --jq, --raw-output and --lean need
--json (--raw-output also needs --jq), and
--no-truncate/--locale/-w/-r have no output to affect.
bb completion install
Section titled “bb completion install”bb completion install [options]This command is interactive. It asks two questions:
- “Which Shell do you use ?”; pick
bash,zsh, orfish. The default isbash; the prompt does not preselect your current shell. - “We will install completion to
<file>, is it ok ?”; confirm, or decline and supply an absolute path of your own.
It then appends a source line to that file and writes the completion script
under ~/.config/tabtab/.
| Shell | Config file offered |
|---|---|
| bash | ~/.bashrc |
| zsh | ~/.zshrc |
| fish | ~/.config/fish/config.fish |
Because it prompts, bb completion install is not scriptable. It blocks on the
shell question in CI, --json included.
A failure throws error code 9001
(COMPLETION_INSTALL_FAILED) with the message
Failed to install completions: <error>, and the command exits 1.
After installing
Section titled “After installing”Restart your shell, or source the file you chose:
source ~/.bashrc # bashsource ~/.zshrc # zshsource ~/.config/fish/config.fish # fishThen check it works:
bb <Tab> # every top-level command (the root flags are offered too)bb repo <Tab> # clone, create, list, view, delete, cat, ls, default-reviewers, downloadsJSON output
Section titled “JSON output”--json replaces both the success line and the “Restart your shell…” follow-up
with a single object:
{ "success": true, "shellCompletion": { "command": "bb", "installed": true }}bb completion <shell>
Section titled “bb completion <shell>”bb completion bashbb completion zshbb completion fishbb completion powershellPrints the completion script for that shell to stdout and changes nothing on disk. No prompt, so it’s safe in scripts and dotfile setups. Load it from your shell’s startup file:
| Shell | Add this |
|---|---|
| bash | source <(bb completion bash) in ~/.bashrc |
| zsh | source <(bb completion zsh) in ~/.zshrc, after compinit |
| fish | bb completion fish > ~/.config/fish/completions/bb.fish (once) |
| PowerShell | bb completion powershell | Out-String | Invoke-Expression in your $PROFILE |
For PowerShell, this one-liner appends that line to your profile:
Add-Content $PROFILE 'bb completion powershell | Out-String | Invoke-Expression'PowerShell completion is tested on PowerShell 7 (any OS) and shows each command’s and flag’s help text as a tooltip. Windows PowerShell 5.1 is untested.
With --json you get the script inside an envelope:
{ "shell": "powershell", "script": "###-begin-bb-completion-###\n..."}bb completion uninstall only removes what bb completion install set up. To
undo bb completion <shell>, delete the line you added.
bb completion uninstall
Section titled “bb completion uninstall”bb completion uninstall [options]No prompt. It deletes ~/.config/tabtab/bb.<shell>, removes the bb lines from
~/.config/tabtab/__tabtab.<shell>, and drops the source line from your shell
config once no other package is left in that file. Both <shell> and that
config file come from $SHELL (your login shell), not the shell you happen to
be typing in, and not the shell you picked at the install prompt. If they
disagree, the source line is left behind and you have to delete it by hand.
On success it prints ✓ Shell completions uninstalled successfully!; with
--json you get the same envelope as install, with "installed": false.
Most uninstall failures are swallowed by tabtab: it prints
ERROR while uninstalling <error> and resolves anyway, so the command still
reports success and exits 0. Error code 9002
(COMPLETION_UNINSTALL_FAILED) only fires for
failures thrown outside that handler.
What gets completed
Section titled “What gets completed”Completions are generated from the live command tree, so they always match the commands and flags the CLI actually ships.
- Commands and subcommands; every command in the tree, at every depth.
- Options; every flag on the command plus the inherited globals (
--json,--jq,--raw-output,--lean,--no-color,--no-unicode,--no-truncate,--locale,--workspace,--repo,--help), plus--versionon the barebb. Only long forms are suggested; short aliases like-wstill work but are never offered. - Flag values for options with a fixed set of choices.
Commands and flags carry their help text as a completion description. zsh and fish display it alongside the name, PowerShell as a tooltip; bash shows bare names. Enum values never carry a description, so they are bare in every shell.
Flag-value completion
Section titled “Flag-value completion”Completing right after a flag that takes a fixed set of values suggests those values, and nothing else:
$ bb pr merge 42 --strategy <Tab>merge_commit squash fast_forwardsquash_fast_forward rebase_fast_forward rebase_merge
$ bb pr list --state <Tab>OPEN MERGED DECLINED SUPERSEDED
$ bb snippet list --role <Tab>owner contributor member
$ bb pr diff --color <Tab>auto always never
$ bb api -X <Tab>GET POST PUT PATCHHEAD OPTIONS DELETEExample session
Section titled “Example session”$ bb pr<Tab>pr
$ bb pr <Tab>activity approve checks checkout comments create declinediff edit list merge ready reviewers view
$ bb pr create --<Tab># the command's own flags, plus inherited global flags:--title --body --source --destination--close-source-branch --draft --reviewer --default-reviewers--no-default-reviewers--json --jq --raw-output --lean--no-color --no-unicode --no-truncate --locale--workspace --repo --helpRelated
Section titled “Related”- Global Flags; the flags the completer offers on every command.
- Error Codes;
9001and9002in context. - Scripting & Automation;
--jsonenvelopes and exit codes for the non-interactive commands.