---
title: "Shell completion"
seo:
  description: "iso completions <shell> prints a static completion script for bash, zsh, or fish, generated by Swift Argument Parser."
---
<!--
Derived from trailofbits/coop.
Modified by chr33s: ported/adapted for the Swift implementation.
SPDX-License-Identifier: Apache-2.0
-->


`iso completions <shell>` prints a static completion script for **bash**, **zsh**, or **fish**, generated by Swift Argument Parser. It completes subcommands, options, fixed option values, configuration files for `--config`, and directories for options that take a local directory (`--dir`, `--workspace`, …). Generating it loads no configuration or secrets, touches no state, and does not invoke the runtime.

## Static completion

Generate a script once and drop it where your shell looks for completions.

### bash

```sh
mkdir -p ~/.local/share/bash-completion/completions
iso completions bash > ~/.local/share/bash-completion/completions/iso
```

System-wide variant:

```sh
iso completions bash | sudo tee /etc/bash_completion.d/iso > /dev/null
```

### zsh

The completion file must live on `$fpath`. If you don't already have a directory for it:

```sh
mkdir -p ~/.zfunc
echo 'fpath=(~/.zfunc $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
iso completions zsh > ~/.zfunc/_iso
```

### fish

```sh
iso completions fish > ~/.config/fish/completions/iso.fish
```

Restart the shell (or `source` your rc) after the first install.

## Mistakes and conflicts

Errors stay deterministic and name what to change: a misspelled option or
subcommand gets one nearest-name suggestion (`Did you mean 'pull'?`) when a
single name is clearly closest, an option missing its value prints that
option's help line, and mutually exclusive flags are named exactly as given
(`--review and --apply cannot be combined: …`). `iso pull --apply` without
`--stage-id` prints the exact command for the selected stage.

## What is not completed

There is no dynamic completion: instance, image, and profile names are not
completed, and the former `COMPLETE=<shell>` hook is gone (remove any
`source <(COMPLETE=… iso)` line from your shell rc). List those names with
`iso list`, `iso images`, and `iso profiles list`.

PowerShell and Elvish scripts are no longer generated; `iso completions
powershell` or `iso completions elvish` fails with an error naming the
supported shells.
