diff --git a/README.md b/README.md index 9a7106df2..498b03969 100644 --- a/README.md +++ b/README.md @@ -26,18 +26,21 @@ Click in three points: ## A Simple Example ```python -import click +import asyncclick as click +import anyio @click.command() @click.option("--count", default=1, help="Number of greetings.") @click.option("--name", prompt="Your name", help="The person to greet.") -def hello(count, name): +async def hello(count, name): """Simple program that greets NAME for a total of COUNT times.""" for _ in range(count): click.echo(f"Hello, {name}!") + await anyio.sleep(0.2) if __name__ == '__main__': hello() + # alternately: anyio.run(hello.main) ``` ``` diff --git a/docs/complex.rst b/docs/complex.rst index 00e3a470b..cd8514507 100644 --- a/docs/complex.rst +++ b/docs/complex.rst @@ -249,7 +249,7 @@ stores a mapping from subcommand names to the information for importing them. # in lazy_group.py import importlib - import click + import asyncclick as click class LazyGroup(click.Group): def __init__(self, *args, lazy_subcommands=None, **kwargs): @@ -295,7 +295,7 @@ subcommands like so: .. code-block:: python # in main.py - import click + import asyncclick as click from lazy_group import LazyGroup @click.group( @@ -307,14 +307,14 @@ subcommands like so: pass # in foo.py - import click + import asyncclick as click @click.group(help="foo command for lazy example") def cli(): pass # in bar.py - import click + import asyncclick as click from lazy_group import LazyGroup @click.group( @@ -326,7 +326,7 @@ subcommands like so: pass # in baz.py - import click + import asyncclick as click @click.group(help="baz command for lazy example") def cli(): diff --git a/tests/typing/typing_aliased_group.py b/tests/typing/typing_aliased_group.py index a1fdac4b2..601532470 100644 --- a/tests/typing/typing_aliased_group.py +++ b/tests/typing/typing_aliased_group.py @@ -4,7 +4,7 @@ from typing_extensions import assert_type -import click +import asyncclick as click class AliasedGroup(click.Group): diff --git a/tests/typing/typing_confirmation_option.py b/tests/typing/typing_confirmation_option.py index a568a6ad0..31e4f8c07 100644 --- a/tests/typing/typing_confirmation_option.py +++ b/tests/typing/typing_confirmation_option.py @@ -2,7 +2,7 @@ from typing_extensions import assert_type -import click +import asyncclick as click @click.command() diff --git a/tests/typing/typing_group_kw_options.py b/tests/typing/typing_group_kw_options.py index 579132fac..5fc68606b 100644 --- a/tests/typing/typing_group_kw_options.py +++ b/tests/typing/typing_group_kw_options.py @@ -1,6 +1,6 @@ from typing_extensions import assert_type -import click +import asyncclick as click @click.group(context_settings={}) diff --git a/tests/typing/typing_help_option.py b/tests/typing/typing_help_option.py index 6b822c131..dbe1b9be7 100644 --- a/tests/typing/typing_help_option.py +++ b/tests/typing/typing_help_option.py @@ -1,6 +1,6 @@ from typing_extensions import assert_type -import click +import asyncclick as click @click.command() diff --git a/tests/typing/typing_options.py b/tests/typing/typing_options.py index 613e8d43d..c020cad78 100644 --- a/tests/typing/typing_options.py +++ b/tests/typing/typing_options.py @@ -2,7 +2,7 @@ from typing_extensions import assert_type -import click +import asyncclick as click @click.command() diff --git a/tests/typing/typing_password_option.py b/tests/typing/typing_password_option.py index 8537e6ff5..a7d679df6 100644 --- a/tests/typing/typing_password_option.py +++ b/tests/typing/typing_password_option.py @@ -2,7 +2,7 @@ from typing_extensions import assert_type -import click +import asyncclick as click @click.command() diff --git a/tests/typing/typing_simple_example.py b/tests/typing/typing_simple_example.py index 641937c5d..4d67fe1ce 100644 --- a/tests/typing/typing_simple_example.py +++ b/tests/typing/typing_simple_example.py @@ -2,7 +2,7 @@ from typing_extensions import assert_type -import click +import asyncclick as click @click.command() diff --git a/tests/typing/typing_version_option.py b/tests/typing/typing_version_option.py index 7ff37a75f..63c293614 100644 --- a/tests/typing/typing_version_option.py +++ b/tests/typing/typing_version_option.py @@ -4,7 +4,7 @@ from typing_extensions import assert_type -import click +import asyncclick as click @click.command()