Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

bashcomplete creation from python lists and dictionaries.

Project description

# Overview

`python-bashcomplete` takes:

* Lists of strings and dictionaries, or
* Nested dictionaries

and compiles simple, yet functional bashcomplete code for any program that
invokes bashcomplete.BashComplete() with a list or dictionary.

# Setup

pip install python-bashcomplete

# Example structures

Autocompletes one level:

test = ['level1a', 'level1b']

Autocompletes two possibilities, both of which have sublevels:

test = {
'level1a': ['1', '2', '3'],
'level1b': ['4', '5', '6']

Autocompletes three possibilities, only two of which have sublevels:

test = [
'level1a': ['1', '2', '3']
'level1b': ['4', '5', '6']

Autocompletes only one level. Final string values are ignored:

test = {

Autocomplete with autogenerated words:

test = {
'files': ['`ls -1`'],
'devices': ['`ls -1 /dev`']

# Generation

Add the following lines to your command-line program:

import bashcomplete

where `test` is your data structure. This will generate
`<filename>.bash_complete` in your current folder using the filename of the
executing program.

If you wish to constrain the autocomplete words to only what has been defined,

bashcomplete.BashComplete(test, constrain=True)

If you wish to create a .bash_complete file with another name use:

bashcomplete.BashComplete(test, filename='', output_filename='myprogram_py_cloudversion')

# Usage

Use the generated `<filename>.bash_complete` by adding:

. /path/to/<filename>.bash_complete

to your `.profile`. From this point on, any run of `<filename>` will use the
generated bash completion.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
python-bashcomplete-1.2-0.tar.gz (3.8 kB) Copy SHA256 hash SHA256 Source None Jan 4, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page