Skip to content
Open
Show file tree
Hide file tree
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
49 changes: 49 additions & 0 deletions docs/cli/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,52 @@ viam --help
viam machines --help
viam machines part shell --help
```

## Enable shell completion

The CLI supports tab completion for commands, subcommands, and flag names.
To enable it, load the completion script for your shell.

Comment on lines +208 to +210
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 15b6345. Changed "source" to "load" throughout.


Generated by Claude Code

{{< tabs >}}
{{% tab name="bash" %}}

Add to your `~/.bashrc`:

```sh {class="command-line" data-prompt="$"}
source <(viam completion bash)
```

{{% /tab %}}
{{% tab name="zsh" %}}

Add to your `~/.zshrc`:

```sh {class="command-line" data-prompt="$"}
source <(viam completion zsh)
```

{{% /tab %}}
{{% tab name="fish" %}}

```sh {class="command-line" data-prompt="$"}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 15b6345. Added mkdir -p ~/.config/fish/completions before the redirect.


Generated by Claude Code

mkdir -p ~/.config/fish/completions
viam completion fish > ~/.config/fish/completions/viam.fish
```

{{% /tab %}}
{{% tab name="PowerShell" %}}

```powershell {class="command-line" data-prompt=">"}
viam completion pwsh | Out-String | Invoke-Expression
```

{{% /tab %}}
{{< /tabs >}}

After loading the script, press **Tab** to complete commands and flags:

```sh {class="command-line" data-prompt="$"}
viam <Tab> # lists all commands
viam machines <Tab> # lists subcommands of machines
viam data export <Tab> # lists subcommands of export
```
22 changes: 22 additions & 0 deletions docs/cli/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ viam [global options] command [command options] [arguments...]

## Commands

### `completion`

The `completion` command outputs a shell completion script.
Load the output in your shell to enable tab completion for commands, subcommands, and flag names.

```sh {class="command-line" data-prompt="$"}
viam completion bash
viam completion zsh
viam completion fish
viam completion pwsh
```

<!-- prettier-ignore -->
| Argument | Description |
| -------- | ----------- |
| `bash` | Output a bash completion script. |
| `zsh` | Output a zsh completion script. |
| `fish` | Output a fish completion script. |
| `pwsh` | Output a PowerShell completion script. |

For setup instructions, see [Enable shell completion](/cli/overview/#enable-shell-completion).

### `data`

The `data` command allows you to manage machine data.
Expand Down
Loading