Skip to content

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.

Terminal window
bb completion install [options]

This command is interactive. It asks two questions:

  1. “Which Shell do you use ?”; pick bash, zsh, or fish. The default is bash; the prompt does not preselect your current shell.
  2. “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.

Restart your shell, or source the file you chose:

Terminal window
source ~/.bashrc # bash
source ~/.zshrc # zsh
source ~/.config/fish/config.fish # fish

Then check it works:

Terminal window
bb <Tab> # every top-level command (the root flags are offered too)
bb repo <Tab> # clone, create, list, view, delete, cat, ls, default-reviewers, downloads

--json replaces both the success line and the “Restart your shell…” follow-up with a single object:

{
"success": true,
"shellCompletion": {
"command": "bb",
"installed": true
}
}
Terminal window
bb completion bash
bb completion zsh
bb completion fish
bb completion powershell

Prints 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:

Terminal window
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.

Terminal window
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.

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 --version on the bare bb. Only long forms are suggested; short aliases like -w still 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.

Completing right after a flag that takes a fixed set of values suggests those values, and nothing else:

Terminal window
$ bb pr merge 42 --strategy <Tab>
merge_commit squash fast_forward
squash_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 PATCH
HEAD OPTIONS DELETE
Terminal window
$ bb pr<Tab>
pr
$ bb pr <Tab>
activity approve checks checkout comments create decline
diff 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 --help