Metadata-Version: 2.1
Name: asyncclick-repl
Version: 0.1.2
Summary: Command class to add REPL support to existing click groups
Project-URL: Source, https://github.com/fedej/aio-rom
Author-email: fedej <fede_654_87@hotmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Shells
Requires-Python: >=3.8
Requires-Dist: anyio<5.0.0,>=4.2.0
Requires-Dist: asyncclick<9,>=8.1.3.4
Requires-Dist: prompt-toolkit<4.0.0,>=3.0.43
Provides-Extra: dev
Requires-Dist: bandit; extra == 'dev'
Requires-Dist: black; extra == 'dev'
Requires-Dist: flake8; extra == 'dev'
Requires-Dist: flake8-bugbear; extra == 'dev'
Requires-Dist: flake8-comprehensions; extra == 'dev'
Requires-Dist: isort; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Description-Content-Type: text/markdown

# asyncclick-repl

Command to make a REPL out of a group by passing `-i` or `--interactive` to the cli.
Inspired by [click-repl](https://github.com/click-contrib/click-repl) but using native
click command and shell completion.

```python
import asyncio

import asyncclick as click

from asyncclick_repl import AsyncREPL


@click.group(cls=AsyncREPL)
async def cli():
    pass


@cli.command()
@click.option("--count", default=1, help="Number of greetings.")
@click.option("--name", prompt="Your name", help="The person to greet.")
async def hello(count, name):
    """Simple program that greets NAME for a total of COUNT times."""
    for _ in range(count):
        await asyncio.sleep(0.1)
        click.echo(f"Hello, {name}!")


cli(_anyio_backend="asyncio")
```

```shell
myclickapp -i

> hello --count 2 --name Foo
Hello, Foo!
Hello, Foo!
> :q
```

# Features:

- Tab-completion. Using click's shell completion
- Execute system commands using `!` prefix. Note: `!` should be followed by a space e.g `! ls`
- `:h` show commands help.

# Prompt configuration

Use `prompt_kwargs` to provide configuration to `python-prompt-toolkit`'s `Prompt` class

```python
import asyncclick as click
from prompt_toolkit.history import FileHistory

from asyncclick_repl import AsyncREPL

prompt_kwargs = {
    "history": FileHistory("./history"),
}


@click.group(cls=AsyncREPL, prompt_kwargs=prompt_kwargs)
async def cli():
    pass


cli()
```
