Skip to main content
# 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']
},
'level1c'
]

Autocompletes only one level. Final string values are ignored:

test = {
'level1a':{'a'},
'level1b':{'b'}
}

Autocomplete with autogenerated words:

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

# Generation

Add the following lines to your command-line program:

import bashcomplete
bashcomplete.BashComplete(test)

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,
use:

bashcomplete.BashComplete(test, constrain=True)

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

bashcomplete.BashComplete(test, filename='myprogram.py', 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.

Metadata

Release files for python-bashcomplete 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 python-bashcomplete 1.2-0
File Size Uploaded Provenance Actions
python-bashcomplete-1.2-0.tar.gz 3.8 kB Without provenance Details for python-bashcomplete-1.2-0.tar.gz

Release files / python-bashcomplete-1.2-0.tar.gz

Download URL python-bashcomplete-1.2-0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b4e6350d4a2144b2f61e154b527af2d4e581a8eab305979e96dc09378c3a5dc2
BLAKE2b-256 checksum
How to use checksums
5d59b141a9f1e730291261b292c642b3c8919983010509a695178fb349d0b2bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-bashcomplete 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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