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.