Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Add CLI shell completion documentation #112

Merged
merged 2 commits into from
May 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions _articles/miscellaneous/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Bitwarden provides a powerful, full-featured command-line interface (CLI) tool t
- [Version](#version)
- [Working with JSON](#working-with-json)
- [Self-signed Certificates](#self-signed-certificates)
- [Shell Completion](#shell-completion)
- [ZSH](#zsh)
- [Source Code](#source-code)
- [Appendix](#appendix)
- [Templates](#templates)
Expand Down Expand Up @@ -427,6 +429,40 @@ If your self-hosted Bitwarden server exposes as self-signed TLS certificate, spe

$env:NODE_EXTRA_CA_CERTS="absolute/path/to/your/certificates.pem"


## Shell Completion

Bitwarded CLI comes with support for shell completion. It can generate shell completion scripts that you can use to enable completion for `bw` in your shell.

### ZSH

You can enable `bw` completion for ZSH using various methods. A few of them are mentioned below:

**vanilla (.zshrc)**:

Add the following line in your `.zshrc` file:

```
eval "$(bw completion --shell zsh); compdef _bw bw;"
```

**vanilla (vendor-completions)**:

Run the following command:

```
bw completion --shell zsh | sudo tee /usr/share/zsh/vendor-completions/_bw
```

[**zinit**](https://github.com/zdharma/zinit):

Run the following commands:

```
bw completion --shell zsh > ~/.local/share/zsh/completions/_bw
zinit creinstall ~/.local/share/zsh/completions
```

## Source Code

As with everything here at Bitwarden, the CLI is fully open source and hosted on GitHub at <https://github.com/bitwarden/cli>.
Expand Down