asyncclick-repl-0.1.1
توضیحات
Command class to add REPL support to existing click groups
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | asyncclick-repl-0.1.1 |
| نام | asyncclick-repl |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Federico Jaite |
| ایمیل نویسنده | fede_654_87@hotmail.com |
| آدرس صفحه اصلی | https://github.com/fedej/asyncclick-repl |
| آدرس اینترنتی | https://pypi.org/project/asyncclick-repl/ |
| مجوز | MIT |
# 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()
```
نیازمندی
| مقدار | نام |
|---|---|
| >=8.1.3.4,<9.0.0.0 | asyncclick |
| >=3.0.31,<4.0.0 | prompt-toolkit |
| >=3.2.1,<4.0.0 | anyio |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl asyncclick-repl-0.1.1:
pip install asyncclick-repl-0.1.1.whl
نصب پکیج tar.gz asyncclick-repl-0.1.1:
pip install asyncclick-repl-0.1.1.tar.gz