This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
Copyright (c) 2014-2015 Markus Unterwaditzer & contributors.
Copyright (c) 2016-2026 Asif Saif Uddin & contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,117 @@
Metadata-Version: 2.1
Name: click-repl
Version: 0.3.0
Summary: REPL plugin for Click
Home-page: https://github.com/untitaker/click-repl
Author: Markus Unterwaditzer
Author-email: markus@unterwaditzer.net
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click (>=7.0)
Requires-Dist: prompt-toolkit (>=3.0.36)
Provides-Extra: testing
Requires-Dist: pytest-cov (>=4.0.0) ; extra == 'testing'
Requires-Dist: pytest (>=7.2.1) ; extra == 'testing'
Requires-Dist: tox (>=4.4.3) ; extra == 'testing'
click-repl
===
[![Tests](https://github.com/click-contrib/click-repl/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/click-contrib/click-repl/actions/workflows/tests.yml)
[![License](https://img.shields.io/pypi/l/click-repl?label=License)](https://github.com/click-contrib/click-repl/LICENSE)
![Python - version](https://img.shields.io/badge/python-3%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)
[![PyPi - version](https://img.shields.io/badge/pypi-v0.2.0-blue)](https://pypi.org/project/click-repl/)
![wheels](https://img.shields.io/piwheels/v/click-repl?label=wheel)
![PyPI - Status](https://img.shields.io/pypi/status/click)
![PyPI - Downloads](https://img.shields.io/pypi/dm/click-repl)
Installation
===
Installation is done via pip:
```
pip install click-repl
```
Usage
===
In your [click](http://click.pocoo.org/) app:
```py
import click
from click_repl import register_repl
@click.group()
def cli():
pass
@cli.command()
def hello():
click.echo("Hello world!")
register_repl(cli)
cli()
```
In the shell:
```
$ my_app repl
> hello
Hello world!
> ^C
$ echo hello | my_app repl
Hello world!
```
**Features not shown:**
- Tab-completion.
- The parent context is reused, which means `ctx.obj` persists between
subcommands. If you're keeping caches on that object (like I do), using the
app's repl instead of the shell is a huge performance win.
- `!` - prefix executes shell commands.
You can use the internal `:help` command to explain usage.
Advanced Usage
===
For more flexibility over how your REPL works you can use the `repl` function
directly instead of `register_repl`. For example, in your app:
```py
import click
from click_repl import repl
from prompt_toolkit.history import FileHistory
@click.group()
def cli():
pass
@cli.command()
def myrepl():
prompt_kwargs = {
'history': FileHistory('/etc/myrepl/myrepl-history'),
}
repl(click.get_current_context(), prompt_kwargs=prompt_kwargs)
cli()
```
And then your custom `myrepl` command will be available on your CLI, which
will start a REPL which has its history stored in
`/etc/myrepl/myrepl-history` and persist between sessions.
Any arguments that can be passed to the [`python-prompt-toolkit`](https://github.com/prompt-toolkit/python-prompt-toolkit) [Prompt](http://python-prompt-toolkit.readthedocs.io/en/stable/pages/reference.html?prompt_toolkit.shortcuts.Prompt#prompt_toolkit.shortcuts.Prompt) class
can be passed in the `prompt_kwargs` argument and will be used when
instantiating your `Prompt`.

View File

@@ -0,0 +1,16 @@
click_repl-0.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
click_repl-0.3.0.dist-info/LICENSE,sha256=w5qXIkFz5heQemLXVoSEvYPgWlplXqlCQH3DWjIetDE,1141
click_repl-0.3.0.dist-info/METADATA,sha256=DF4pXhK8sH8aQ33WNAfX-umqGuIG8fgTmjehMdmBqG0,3553
click_repl-0.3.0.dist-info/RECORD,,
click_repl-0.3.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
click_repl-0.3.0.dist-info/top_level.txt,sha256=F6rJUNCBcNeCP3tglg54K9NGWoA0azS09pH1B3V5LbQ,11
click_repl/__init__.py,sha256=t3mMAVXruN3TZ72aXXHqk__ySRx7yyia8S8QnFd8Oq8,514
click_repl/__pycache__/__init__.cpython-312.pyc,,
click_repl/__pycache__/_completer.cpython-312.pyc,,
click_repl/__pycache__/_repl.cpython-312.pyc,,
click_repl/__pycache__/exceptions.cpython-312.pyc,,
click_repl/__pycache__/utils.cpython-312.pyc,,
click_repl/_completer.py,sha256=0otlzltYbyc6BLv-kGV1S-jKPASd-ZJPfyiXsR9BkLE,9760
click_repl/_repl.py,sha256=ABz22IoLkKEcfU7_gHbXTk7e96oxrUgDuumyjMs-ja8,4513
click_repl/exceptions.py,sha256=b2623jlSGVISztcC07xZ6Dg1OwGbsyhwGDkEWRlQ2yU,445
click_repl/utils.py,sha256=2r--kMG24BaF8d_RypX2KSpfKdrWkPI2YEHd5cFCbMY,6119

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.37.1)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1 @@
click_repl