---
name: "dh_shell_completions"
section: "1"
platform: "linux"
package: "dh-shell-completions"
version: "0.1.0"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/dh_shell_completions"
---

# dh\_shell\_completions(1)

install shell completions for package

## NAME

dh\_shell\_completions - install shell completions for package

## SYNOPSIS

**dh\_shell\_completions** \[*debhelper options*\]

## DESCRIPTION

dh\_shell\_completions is a debhelper addon for installing completion scripts for multiple shells, respecting conventions of each shell.

It currently supports **bash**, **fish**, and **zsh**.

To use it, **Build-Depends** on it, and pass **--with shell\_completions** to debhelper.

There are several modes of action, listed in **MODES**. The first has highest precedence, the last lowest.

For all modes, mentioned files can have comment lines, starting with \`#\`.

*$package* in file names, if omitted, will be the first binary package defined in debian/control.

## MODES

### Generation

If a file named *debian/\[$package.\]shell-completions* exists, and its first non-comment line is:

```
        mode=gen
```

Then the remaining lines should be one or more stanzas, each in the format:

```
        command=command-to-generate --completions _SHELL_ [--write-to _PATH_]
        shells=bash,fish,zsh
        name=foo
```

- *command*

  command to generate a completion script. Assumed to print to stdout unless it contains the *\_PATH\_* placeholder.

  **\_SHELL\_** is a placeholder for each shell in *shells*.

  **\_PATH\_** is an optional placeholder for the path to write the completion script to, if the command works that way.

- *shells*

  a comma separated list of supported shell names to generate for.

- *name*

  an optional line to specify the name of generated completions other than *$package*.

*command* will be run for each *\_SHELL\_* specified in *shells*, and installs the resulting completions with specified *name*.

### Composite

If a file named *debian/\[$package.\]shell-completions* exists, and is in the format:

```
        $shell completions/foo      # installed as foo
        $shell completions/bar baz  # installed as baz
```

then for each line, the referenced file will be installed as a completion script for *$shell*, named as the comments suggest.

### Separate

If a file named *debian/\[$package.\]$shell-completions* exists for a supported *$shell*, then one of two actions are taken, depending on its content.

If it's of the following format:

```
        completions/foo               # installed as foo
        completions/bar baz           # installed as baz
```

then the referenced file(s) will be installed as completion(s) for *$shell*, named as the comments above suggest.

Otherwise, it's taken as a full completion script, and installed for *$shell*, named *$package*. This is in line with dh\_bash-completion.

## SEE ALSO

[**debhelper**(1)](/debhelper/1.md)

## AUTHOR

Blair Noctis \<ncts@debian.org\>
