click-didyoumean
Enable git-like did-you-mean feature in click.
It’s as simple as this:
import click
from click_didyoumean import DYMGroup
@click.group(cls=DYMGroup)
def cli():
...
Usage
Install this extension with pip:
pip install click-didyoumean
Use specific did-you-mean group class for your cli:
import click
from click_didyoumean import DYMGroup
@click.group(cls=DYMGroup)
def cli():
pass
@cli.command()
def foo():
pass
@cli.command()
def bar():
pass
@cli.command()
def barrr():
pass
if __name__ == "__main__":
cli()
Or you it in a CommandCollection:
import click
from click_didyoumean import DYMCommandCollection
@click.group()
def cli1():
pass
@cli1.command()
def foo():
pass
@cli1.command()
def bar():
pass
@click.group()
def cli2():
pass
@cli2.command()
def barrr():
pass
cli = DYMCommandCollection(sources=[cli1, cli2])
if __name__ == "__main__":
cli()
Change configuration
There are two configuration for the DYMGroup and DYMCommandCollection:
Parameter |
Type |
Default |
Description |
|---|---|---|---|
max_suggestions |
int |
3 |
Maximal number of did-you-mean suggestions |
cutoff |
float |
0.5 |
Possibilities that don’t score at least that similar to word are ignored. |
Examples
@cli.group(cls=DYMGroup, max_suggestions=2, cutoff=0.7)
def cli():
pass
... or ...
cli = DYMCommandCollection(sources=[cli1, cli2], max_suggestions=2, cutoff=0.7)
Metadata
Release files for click-didyoumean 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| click_didyoumean-0.3.1.tar.gz | 3.1 kB | Without provenance | Details for click_didyoumean-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| click_didyoumean-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for click_didyoumean-0.3.1-py3-none-any.whl |
Total release size: 6.7 kB
Release files / click_didyoumean-0.3.1.tar.gz
| Download URL | click_didyoumean-0.3.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f82fdff0dbe64ef8ab2279bd6aa3f6a99c3b28c05aa09cbfc07c9d7fbb5a463
|
|
BLAKE2b-256 checksum How to use checksums |
30ce217289b77c590ea1e7c24242d9ddd6e249e52c795ff10fac2c50062c48cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.13 Linux/6.5.0-1016-azure
|
Release files / click_didyoumean-0.3.1-py3-none-any.whl
| Download URL | click_didyoumean-0.3.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c4bb6007cfea5f2fd6583a2fb6701a22a41eb98957e63d0fac41c10e7c3117c
|
|
BLAKE2b-256 checksum How to use checksums |
1b5b974430b5ffdb7a4f1941d13d83c64a0395114503cc357c6b9ae4ce5047ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.13 Linux/6.5.0-1016-azure
|
Security for click-didyoumean 0.3.1
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.