LinuxCommandLibrary

dh_bash-completion

Install bash completion files for Debian packages

SYNOPSIS

dh_bash-completion [debhelper options] [--name=name] [<package> ...]

PARAMETERS

--name=name
    Use debian/<package>.name.bash-completion as the source file instead of default debian/<package>.bash-completion.

-ppackage, --package=package
    Limit action to the named binary package.

-a, --all-packages
    Act on files for all binary packages, even unmentioned ones.

-Npackage, --no-package=package
    Exclude the named binary package from processing.

--no-act
    Show what would be done without making changes.

DESCRIPTION

dh_bash-completion is a debhelper program that installs bash tab-completion scripts for commands in Debian packages. It automatically locates completion files named debian/<package>.bash-completion in the source tree and copies them to /usr/share/bash-completion/completions/<program> (or multiarch-aware paths) in the binary package.

Package maintainers place these files to enable automatic command-line completion when users have bash-completion enabled (via /etc/bash_completion or /usr/share/bash-completion/bash_completion). The tool integrates seamlessly into debian/rules files, typically via dh $@ --with=bash-completion, ensuring correct installation order after dh_install but before dh_installdocs or dh_compress.

This simplifies providing user-friendly shell integration, reducing manual setup. It supports multiple packages and custom names via options, making it essential for CLI tools seeking polished Debian packaging.

CAVEATS

Invoke after dh_install and before dh_installdeb; add bash-completion to package Depends if providing completions. Bash-only; other shells require separate tools.

DEBIAN/RULES INTEGRATION

Use dh $@ --with=bash-completion or explicitly dh_bash-completion in override_dh_auto_install targets.

COMPLETION FILE FORMAT

Files should contain complete -F _func program or direct _program() functions compatible with bash-completion framework.

HISTORY

Added in debhelper 7.4 (2008) to support bash-completion 1.1's directory-based completions, replacing older /etc/bash_completion.d integration.

SEE ALSO

dh(1), debhelper(7), bash-completion(7), complete(1)

Copied to clipboard