# aspire completions script command

## Name

`aspire completions script` - Write a shell completion script to standard output.

## Synopsis

```bash title="Aspire CLI"
aspire completions script [<shell>] [options]
```

## Description

The `aspire completions script` command writes a completion script for the specified shell to standard output. Source the script in your current session, or add it to your shell profile, to get <kbd>Tab</kbd> completion for `aspire` commands, subcommands, options, and values that have a completion source, such as enum values.

The command writes only the script, with no banner, colors, or markup, so it's safe to redirect to a file or pipe to another command.

If you omit the shell argument, the CLI infers the shell from the `SHELL` environment variable. On Windows, when `SHELL` doesn't name a supported shell, the CLI uses `pwsh`. If the shell can't be inferred, the command fails and asks you to specify one.

**Tip:** Specify the shell explicitly in installers and profile snippets. A login shell
  isn't necessarily the shell that's currently running.

For step-by-step setup, removal, and troubleshooting, see [Shell completion](/reference/cli/shell-completion/).

## Arguments

- **`<shell>`**

  The shell to generate a script for. Possible values are `bash`, `fish`, `pwsh`, and `zsh`. `pwsh` requires PowerShell 7 or later. `cmd.exe` and Windows PowerShell aren't supported. Defaults to the shell named by `SHELL`, or `pwsh` on Windows.

## Options

The following options are available:

- <Include relativePath="reference/cli/includes/option-help.md" />

- <Include relativePath="reference/cli/includes/option-log-level.md" />

- <Include relativePath="reference/cli/includes/option-non-interactive.md" />

- <Include relativePath="reference/cli/includes/option-nologo.md" />

- <Include relativePath="reference/cli/includes/option-banner.md" />

- <Include relativePath="reference/cli/includes/option-wait.md" />

## Examples

- Enable completion in the current Bash shell:

  ```bash title="Bash"
  source <(aspire completions script bash)
  ```

- Enable completion in the current Zsh shell:

  ```zsh title="Zsh"
  source <(aspire completions script zsh)
  ```

- Enable completion in the current Fish shell:

  ```fish title="Fish"
  aspire completions script fish | source
  ```

- Enable completion in the current PowerShell 7+ session:

  ```powershell title="PowerShell"
  aspire completions script pwsh | Out-String | Invoke-Expression
  ```

- Save a Bash completion script to a file:

  ```bash title="Aspire CLI"
  aspire completions script bash > aspire.bash
  ```

## See also

- [Shell completion](/reference/cli/shell-completion/)
- [aspire completions](../aspire-completions/)