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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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