Skip to main content

bzr bash-completion script and plugin

This script generates a shell function which can be used by bash to automatically complete the currently typed command when the user presses the completion key (usually tab).

It is intended as a bzr plugin, but can be used to some extend as a standalone python script as well.

Copyright (C) 2009, 2010 Martin von Gagern <Martin.vGagern@gmx.net>

Installing

You only need to do this if you want to use the script as a bzr plugin. Otherwise simply grab the bashcomp.py and place it wherever you want.

Installing from bzr repository

To check out the current code from launchpad, use the following commands:

mkdir -p ~/.bazaar/plugins
cd ~/.bazaar/plugins
bzr checkout lp:bzr-bash-completion bash_completion

To update such an installation, execute this command:

bzr update ~/.bazaar/plugins/bash_completion

Installing using easy_install

The following command should install the latest release of the plugin on your system:

easy_install bzr-bash-completion

To use this method, you need to have Easy Install installed and also have write access to the required directories. So maybe you should execute this command as root or through sudo. Or you want to install to a different location.

Installing from tarball

If you have grabbed a source code tarball, or want to install from a bzr checkout in a different place than your bazaar plugins directory, then you should use the setup.py script shipped with the code:

./setup.py install

If you want to install the plugin only for your own user account, you might wish to pass the option --user or --home=$HOME to that command. For further information please read the manuals of distutils as well as setuptools or distribute, whatever is available on your system, or have a look at the command line help:

./setup.py install --help

Using

Using as a plugin

This is the preferred method of generating the completion function, as it will ensure proper bzr initialization.

eval "`bzr bash-completion`"

Lazy initialization

Running the above command automatically from your ~/.bashrc file or similar can cause annoying delays in the startup of your shell. To avoid this problem, you can delay the generation of the completion function until you actually need it.

To do so, source the file lazy.sh shipped with this package from your ~/.bashrc file or add it to your ~/.bash_completion if your setup uses such a file. On a system-wide installation, the directory /usr/share/bash-completion/ might contain such bash completion scripts.

If you installed bzr-bash-completion from the repository or a source tarball, you find the lazy.sh script in the root of the source tree. If you installed the plugin using easy_install, you should grab the script manually from the bzr repository, e.g. through the bazaar web interface on launchpad.

Note that the full completion function is generated only once per shell session. If you update your bzr installation or change the set of installed plugins, then you might wish to regenerate the completion function manually as described above in order for completion to take these changes into account.

Using as a script

As an alternative, if bzrlib is available to python scripts, the following invocation should yield the same results without requiring you to add a plugin:

eval "`./bashcomp.py`"

This approach might have some issues, though, and provides less options than the bzr plugin. Therefore if you have the choice, go for the plugin setup.

Design concept

The plugin (or script) is designed to generate a completion function containing all the required information about the possible completions. This is usually only done once when bash initializes. After that, no more invocations of bzr are required. This makes the function much faster than a possible implementation talking to bzr for each and every completion. On the other hand, this has the effect that updates to bzr or its plugins won’t show up in the completions immediately, but only after the completion function has been regenerated.

License

As this is built upon a bash completion script originally included in the bzr source tree, and as the bzr sources are covered by the GPL 2, this script here is licensed under these same terms.

If you require a more liberal license, you’ll have to contact all those who contributed code to this plugin, be it for bash or for python.

Metadata

Release files for bzr-bash-completion 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bzr-bash-completion 1.2.0
File Size Uploaded Provenance
bzr-bash-completion-1.2.0.tar.gz 11.9 kB Without provenance Details

Release files / bzr-bash-completion-1.2.0.tar.gz

Download URL bzr-bash-completion-1.2.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d7f0cde4e9ed075f84a32bbfcb8b82a6445a1254000a7be789472437acafee16
BLAKE2b-256 checksum
How to use checksums
fcd485eb97870c196e2e212a926e93e4de0abdba6b80913546484d8ff738d256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for bzr-bash-completion 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page