add
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,118 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: click-repl
|
||||
Version: 0.4.1
|
||||
Summary: REPL plugin for Click
|
||||
Home-page: https://github.com/click-contrib/click-repl
|
||||
Author: Markus Unterwaditzer
|
||||
Author-email: markus@unterwaditzer.net
|
||||
License: MIT
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Programming Language :: Python :: 3.13
|
||||
Classifier: Programming Language :: Python :: 3.14
|
||||
Requires-Python: >=3.9
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
Requires-Dist: click<9.0,>=7.0
|
||||
Requires-Dist: prompt_toolkit>=3.0.36
|
||||
Requires-Dist: typing-extensions>=4.7.0
|
||||
Provides-Extra: testing
|
||||
Requires-Dist: pytest>=7.2.1; extra == "testing"
|
||||
Requires-Dist: pytest-cov>=4.0.0; extra == "testing"
|
||||
Requires-Dist: tox>=4.4.3; extra == "testing"
|
||||
Requires-Dist: flake8>=6.0.0; extra == "testing"
|
||||
Requires-Dist: mypy>=1.9.0; extra == "testing"
|
||||
Dynamic: license-file
|
||||
|
||||
click-repl
|
||||
===
|
||||
|
||||
[](https://github.com/click-contrib/click-repl/actions/workflows/tests.yml)
|
||||
[](https://github.com/click-contrib/click-repl/LICENSE)
|
||||

|
||||
[](https://pypi.org/project/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`.
|
||||
@@ -0,0 +1,23 @@
|
||||
click_repl-0.4.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
click_repl-0.4.1.dist-info/METADATA,sha256=sUEHWnfudE5QWmNpa8kfTQMHyQLLeWyGX4IYGzfn4NA,3685
|
||||
click_repl-0.4.1.dist-info/RECORD,,
|
||||
click_repl-0.4.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
||||
click_repl-0.4.1.dist-info/licenses/LICENSE,sha256=w5qXIkFz5heQemLXVoSEvYPgWlplXqlCQH3DWjIetDE,1141
|
||||
click_repl-0.4.1.dist-info/top_level.txt,sha256=F6rJUNCBcNeCP3tglg54K9NGWoA0azS09pH1B3V5LbQ,11
|
||||
click_repl/__init__.py,sha256=KmjHcZsGk36UTt40NfHocljS0oRSBfbK2Yeeqd0v680,575
|
||||
click_repl/__pycache__/__init__.cpython-311.pyc,,
|
||||
click_repl/__pycache__/_completer.cpython-311.pyc,,
|
||||
click_repl/__pycache__/_ctx_stack.cpython-311.pyc,,
|
||||
click_repl/__pycache__/_repl.cpython-311.pyc,,
|
||||
click_repl/__pycache__/core.cpython-311.pyc,,
|
||||
click_repl/__pycache__/exceptions.cpython-311.pyc,,
|
||||
click_repl/__pycache__/globals_.cpython-311.pyc,,
|
||||
click_repl/__pycache__/utils.cpython-311.pyc,,
|
||||
click_repl/_completer.py,sha256=yY5PoC-YOQB37vgNqhFY9K-aO8copkneLl4ck3WKREA,12485
|
||||
click_repl/_ctx_stack.py,sha256=LVoZg3ILxE9xit28kDSh_z8B6e3N-eMp6oy-YCMoWpk,648
|
||||
click_repl/_repl.py,sha256=LcuhmHtgj7rF_2Asf91hUV3kuI7-5BUD3M3XIvtdvCw,5503
|
||||
click_repl/core.py,sha256=dCgv8h4HiasdydfT9pu31Zacj7qizsLetHBE-uuw_RQ,5854
|
||||
click_repl/exceptions.py,sha256=b2623jlSGVISztcC07xZ6Dg1OwGbsyhwGDkEWRlQ2yU,445
|
||||
click_repl/globals_.py,sha256=rgndLJUo7VtPieysv4-mMR0Qtzzmr5v0ZsE-ZFDE1xQ,1425
|
||||
click_repl/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
click_repl/utils.py,sha256=bIB-B89mbVG_dhjoBwYqtx1xPuNUZ8HqqpLvaHcwx3c,6878
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: setuptools (84.0.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -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.
|
||||
@@ -0,0 +1 @@
|
||||
click_repl
|
||||
Reference in New Issue
Block a user