Skip to content

bb completion

Set shell completion up, or print the script for a shell

Set shell completion up with bb completion install, and take it out with bb completion remove.

bb completion bash, zsh, fish and powershell print the script for that shell, for a startup file you keep yourself. See each one's help for where it goes.

2 commands.

bb completion install
Set completion up so every new shell completes bb
bb completion remove
Take out what bb completion install set up

bb completion install

Set completion up so every new shell completes bb

bb completion install [flags]

Set shell completion up, so every new shell completes bb without anything added by hand.

What it writes loads the script from bb each time, so an upgrade of bb needs nothing done here:

bash        ~/.local/share/bash-completion/completions/bb, which
            bash-completion reads the first time bb is completed
zsh         a marked block at the end of ~/.zshrc
fish        ~/.config/fish/completions/bb.fish
powershell  a marked block in the all-hosts profile of each PowerShell
            installed: Windows PowerShell 5.1 and PowerShell 7 alike

With --all-users it is set up for everyone on this machine, which needs an administrator:

bash        /usr/local/share/bash-completion/completions/bb
zsh         /usr/local/share/zsh/site-functions/_bb, when zsh reads it
fish        completions/bb.fish in fish's configuration directory
powershell  the all-users profile of each PowerShell

On Windows, only PowerShell has a place every user's shell reads. Homebrew and the .deb and .rpm packages install completion for bash, zsh and fish themselves.

Without --shell it sets up the shell bb was started from. Running it again changes nothing, and bb completion remove takes it out.

Windows PowerShell 5.1 runs no profile script under its default execution policy, Restricted. bb then says so rather than write a profile that would not run.

--all-users
For everyone on this machine rather than you; needs an administrator
--shell string
Shell to install completion for (default: the shell bb was started from) (one of: bash, zsh, fish, powershell)

Also takes the global flags.

Dry run: Shows that it would set shell completion up, without doing it; nothing is checked first (predicted)

Output with --json, where ? marks a field that can be absent
data
  shell       bash|zsh|fish|powershell             The shell set up or taken out.
  scope       user|all-users                       user for the person running bb, all-users for everyone on the
                                                   machine.
  targets     list of object or null               Each place the setup went.
    edition?  string                               Which PowerShell: PowerShell 7 or Windows PowerShell 5.1.
    path?     string                               The file written, changed or removed.
    status    installed|updated|unchanged|blocked  installed, updated, unchanged, removed, not_found, or blocked when
                                                   the shell would not run it.
    note?     string                               What the status does not say: why a target is blocked, what the setup
                                                   replaced, or that the script there is a package's, which is left to
                                                   the package.

bb completion remove

Take out what bb completion install set up

bb completion remove [flags]

Take out what bb completion install set up: its file, or its block in a file it shares with you. Nothing else in a shared file is touched.

A script saved from bb completion <shell> where install puts its file is bb's too, and is removed with it. A file bb did not write is left alone, and so is a script a package linked where --all-users writes.

--all-users
For everyone on this machine rather than you; needs an administrator
--shell string
Shell to remove completion for (default: the shell bb was started from) (one of: bash, zsh, fish, powershell)
-y, --yes
Confirm without being asked

Also takes the global flags.

Dry run: Shows that it would take shell completion out, without doing it; nothing is checked first (predicted)

Output with --json, where ? marks a field that can be absent
data
  shell       bash|zsh|fish|powershell  The shell set up or taken out.
  scope       user|all-users            user for the person running bb, all-users for everyone on the machine.
  targets     list of object or null    Each place the setup went.
    edition?  string                    Which PowerShell: PowerShell 7 or Windows PowerShell 5.1.
    path?     string                    The file written, changed or removed.
    status    removed|not_found         installed, updated, unchanged, removed, not_found, or blocked when the shell
                                        would not run it.
    note?     string                    What the status does not say: why a target is blocked, what the setup replaced,
                                        or that the script there is a package's, which is left to the package.