# Shell Completion

Dasel can generate shell completion scripts for **Bash**, **Zsh**, **Fish**, and **PowerShell**. These scripts provide tab-completion for subcommands, flags, and supported data formats.

## Bash

```shell
# Add to ~/.bashrc
source <(dasel completion bash)
```

Or save to a file:

```shell
dasel completion bash > /etc/bash_completion.d/dasel
```

## Zsh

```shell
# Add to ~/.zshrc
source <(dasel completion zsh)
```

Or save to a file:

```shell
dasel completion zsh > "${fpath[1]}/_dasel"
```

{% hint style="info" %}
You may need to run `compinit` after adding the completion script for the first time.
{% endhint %}

## Fish

```shell
dasel completion fish | source
```

Or save to a file:

```shell
dasel completion fish > ~/.config/fish/completions/dasel.fish
```

## PowerShell

```powershell
# Add to your PowerShell profile
dasel completion powershell | Out-String | Invoke-Expression
```

Or save to a file:

```powershell
dasel completion powershell > dasel.ps1
# Then source it in your profile
. ./dasel.ps1
```

## What Gets Completed

The completion scripts provide tab-completion for:

* Subcommands (`query`, `version`, `completion`, `man`, etc.)
* Flags (`--in`, `--out`, `--compact`, `--root`, etc.)
* Data formats when using `--in` or `--out` (e.g. `json`, `yaml`, `toml`, `csv`, `xml`)
* Shell names when using `dasel completion`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://daseldocs.tomwright.me/getting-started/shell-completion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
