click-didyoumean


Nameclick-didyoumean JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/click-contrib/click-didyoumean
SummaryEnables git-like *did-you-mean* feature in click
upload_time2024-03-24 08:22:07
maintainerNone
docs_urlNone
authorTimo Furrer
requires_python>=3.6.2
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            click-didyoumean
================
|pypi| |build| |license|

Enable git-like *did-you-mean* feature in click.

It's as simple as this:

.. code:: python

    import click
    from click_didyoumean import DYMGroup

    @click.group(cls=DYMGroup)
    def cli():
        ...

|demo|

Usage
-----

Install this extension with pip:

.. code::

    pip install click-didyoumean


Use specific *did-you-mean* `group` class for your cli:


.. code:: python

    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`:

.. code:: python

    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
~~~~~~~~

.. code:: python

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


.. |pypi| image:: https://img.shields.io/pypi/v/click-didyoumean.svg?style=flat&label=version
    :target: https://pypi.python.org/pypi/click-didyoumean
    :alt: Latest version released on PyPi

.. |build| image:: https://img.shields.io/travis/click-contrib/click-didyoumean/master.svg?style=flat
    :target: http://travis-ci.org/click-contrib/click-didyoumean
    :alt: Build status of the master branch

.. |demo| image:: https://raw.githubusercontent.com/click-contrib/click-didyoumean/master/examples/asciicast.gif
    :alt: Demo

.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat
    :target: https://raw.githubusercontent.com/click-contrib/click-didyoumean/master/LICENSE
    :alt: Package license

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/click-contrib/click-didyoumean",
    "name": "click-didyoumean",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6.2",
    "maintainer_email": null,
    "keywords": null,
    "author": "Timo Furrer",
    "author_email": "timo.furrer@roche.com",
    "download_url": "https://files.pythonhosted.org/packages/30/ce/217289b77c590ea1e7c24242d9ddd6e249e52c795ff10fac2c50062c48cb/click_didyoumean-0.3.1.tar.gz",
    "platform": null,
    "description": "click-didyoumean\n================\n|pypi| |build| |license|\n\nEnable git-like *did-you-mean* feature in click.\n\nIt's as simple as this:\n\n.. code:: python\n\n    import click\n    from click_didyoumean import DYMGroup\n\n    @click.group(cls=DYMGroup)\n    def cli():\n        ...\n\n|demo|\n\nUsage\n-----\n\nInstall this extension with pip:\n\n.. code::\n\n    pip install click-didyoumean\n\n\nUse specific *did-you-mean* `group` class for your cli:\n\n\n.. code:: python\n\n    import click\n    from click_didyoumean import DYMGroup\n\n    @click.group(cls=DYMGroup)\n    def cli():\n        pass\n\n    @cli.command()\n    def foo():\n        pass\n\n    @cli.command()\n    def bar():\n        pass\n\n    @cli.command()\n    def barrr():\n        pass\n\n    if __name__ == \"__main__\":\n        cli()\n\n\nOr you it in a `CommandCollection`:\n\n.. code:: python\n\n    import click\n    from click_didyoumean import DYMCommandCollection\n\n    @click.group()\n    def cli1():\n        pass\n\n    @cli1.command()\n    def foo():\n        pass\n\n    @cli1.command()\n    def bar():\n        pass\n\n    @click.group()\n    def cli2():\n        pass\n\n    @cli2.command()\n    def barrr():\n        pass\n\n    cli = DYMCommandCollection(sources=[cli1, cli2])\n\n    if __name__ == \"__main__\":\n        cli()\n\n\nChange configuration\n--------------------\n\nThere are two configuration for the ``DYMGroup`` and ``DYMCommandCollection``:\n\n+-----------------+-------+---------+---------------------------------------------------------------------------+\n| Parameter       | Type  | Default | Description                                                               |\n+=================+=======+=========+===========================================================================+\n| max_suggestions | int   | 3       | Maximal number of *did-you-mean* suggestions                              |\n+-----------------+-------+---------+---------------------------------------------------------------------------+\n| cutoff          | float | 0.5     | Possibilities that don\u2019t score at least that similar to word are ignored. |\n+-----------------+-------+---------+---------------------------------------------------------------------------+\n\nExamples\n~~~~~~~~\n\n.. code:: python\n\n    @cli.group(cls=DYMGroup, max_suggestions=2, cutoff=0.7)\n    def cli():\n        pass\n\n    ... or ...\n\n    cli = DYMCommandCollection(sources=[cli1, cli2], max_suggestions=2, cutoff=0.7)\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/click-didyoumean.svg?style=flat&label=version\n    :target: https://pypi.python.org/pypi/click-didyoumean\n    :alt: Latest version released on PyPi\n\n.. |build| image:: https://img.shields.io/travis/click-contrib/click-didyoumean/master.svg?style=flat\n    :target: http://travis-ci.org/click-contrib/click-didyoumean\n    :alt: Build status of the master branch\n\n.. |demo| image:: https://raw.githubusercontent.com/click-contrib/click-didyoumean/master/examples/asciicast.gif\n    :alt: Demo\n\n.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n    :target: https://raw.githubusercontent.com/click-contrib/click-didyoumean/master/LICENSE\n    :alt: Package license\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Enables git-like *did-you-mean* feature in click",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/click-contrib/click-didyoumean",
        "Repository": "https://github.com/click-contrib/click-didyoumean"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b5b974430b5ffdb7a4f1941d13d83c64a0395114503cc357c6b9ae4ce5047ed",
                "md5": "be5e8cf5f80862c7e82e998f648c853a",
                "sha256": "5c4bb6007cfea5f2fd6583a2fb6701a22a41eb98957e63d0fac41c10e7c3117c"
            },
            "downloads": -1,
            "filename": "click_didyoumean-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "be5e8cf5f80862c7e82e998f648c853a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.2",
            "size": 3631,
            "upload_time": "2024-03-24T08:22:06",
            "upload_time_iso_8601": "2024-03-24T08:22:06.356293Z",
            "url": "https://files.pythonhosted.org/packages/1b/5b/974430b5ffdb7a4f1941d13d83c64a0395114503cc357c6b9ae4ce5047ed/click_didyoumean-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "30ce217289b77c590ea1e7c24242d9ddd6e249e52c795ff10fac2c50062c48cb",
                "md5": "a7d95362366d8e8db0f6f5432dcc0279",
                "sha256": "4f82fdff0dbe64ef8ab2279bd6aa3f6a99c3b28c05aa09cbfc07c9d7fbb5a463"
            },
            "downloads": -1,
            "filename": "click_didyoumean-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a7d95362366d8e8db0f6f5432dcc0279",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.2",
            "size": 3089,
            "upload_time": "2024-03-24T08:22:07",
            "upload_time_iso_8601": "2024-03-24T08:22:07.499940Z",
            "url": "https://files.pythonhosted.org/packages/30/ce/217289b77c590ea1e7c24242d9ddd6e249e52c795ff10fac2c50062c48cb/click_didyoumean-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-24 08:22:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "click-contrib",
    "github_project": "click-didyoumean",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "click-didyoumean"
}
        
Elapsed time: 0.58727s