> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cowboy.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# cowboy completions

> Print a shell completion script to stdout

## Synopsis

```bash theme={null}
cowboy completions <shell>
```

## Behavior

1. Generate the completion script for the named shell from the CLI's own command definitions, so it always matches the installed `cowboy` version.
2. Write the script to stdout. The script is rendered into memory first, so piping into `head` (a closed pipe) exits cleanly instead of panicking.

No network, project, or key is involved.

## Flags

| Flag | Default | Description |
| - | - | - |
| `<shell>` | Required | One of `bash`, `zsh`, `fish`, `elvish`, `powershell` |

## Example

```bash theme={null}
$ cowboy completions zsh > ~/.zfunc/_cowboy
$ cowboy completions bash | head -5
_cowboy() {
    local i cur prev opts cmd
    ...
```

## Edge Cases

* An unrecognized shell name is rejected by argument parsing with the accepted values listed.
* A broken pipe on stdout is treated as success; any other write error fails the command.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.