Skip to main content

Fuzzy command matching and aliases for click

Project description

Fuzzy Commands for Click

Fuzzy command matching and aliases for click

version license

Allows use of automatic prefix aliases and matching small typos:

$ command h
WARNING: Assuming 'h' is short for 'hello'
Hello world!

$ command helol
WARNING: Assuming 'helol' is slang for 'hello'
Hello world!

Explicit aliases can also be defined:

$ command --help
Usage: command [OPTIONS] COMMAND [ARGS]...

Commands:
  hello, hi  The traditional greeting

$ command hi --help
Usage: command hello [OPTIONS]

Install

$ pip install click-fuzzy

Usage

from click_fuzzy import FuzzyCommandGroup

@click.group(cls=FuzzyCommandGroup)
def main(...):
    ...

@main.command("hello")
@main.alias("hi")
def hello():
    ...

That's it. Everything else happens automatically.

If you only want explicit aliases, and don't want automatic prefix or fuzzy matching, use AliasedCommandGroup instead of FuzzyCommandGroup:

License

Fuzzy Commands is copyright Amethyst Reese, and licensed under the MIT license.

Project details


Download files

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

Source Distribution

click_fuzzy-0.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

click_fuzzy-0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file click_fuzzy-0.2.tar.gz.

File metadata

  • Download URL: click_fuzzy-0.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for click_fuzzy-0.2.tar.gz
Algorithm Hash digest
SHA256 a2ace5da2941650c12cf9de6008e11d1d6a07f4baca4280d5cdee92c9bec9332
MD5 3b727b63f22ad04b9edba997566466c2
BLAKE2b-256 4471e6b534eaadd5d9fa150898534fb2ec198537be950f3510bc97cc91486730

See more details on using hashes here.

File details

Details for the file click_fuzzy-0.2-py3-none-any.whl.

File metadata

  • Download URL: click_fuzzy-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for click_fuzzy-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4a6deaeee4ef4abd98276a0d7a36dbf7bf0729bc747cc22ace1335400a1a9bb
MD5 e2ee21cb2b93850948963cc98bdbfa37
BLAKE2b-256 9c7c60dcbb3b015c450b0acba3a08fe5417e7451229a7d5f2a2c632ad7038a93

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page