Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2ae1ac6
Merged PR#65 and #69
GhostOps77 Jan 31, 2023
369023d
Updated README.md
GhostOps77 Jan 31, 2023
ed06bc8
Moved config to .cfg file
GhostOps77 Jan 31, 2023
78d1858
Added for annotation feature
GhostOps77 Jan 31, 2023
fddf869
Created setup.cfg
GhostOps77 Jan 31, 2023
cf09d80
Added more Python versions
GhostOps77 Jan 31, 2023
22504db
Moved config to setup.cfg
GhostOps77 Jan 31, 2023
1eccc3d
Added pyproject.toml
GhostOps77 Jan 31, 2023
15254e4
Added more badges
GhostOps77 Jan 31, 2023
15fcb77
Added more badges
GhostOps77 Jan 31, 2023
cfc88e7
Added black formatter in gh-actions: .github/workflows/black.yml
GhostOps77 Feb 1, 2023
aea5aa1
Bumped actions version: .github/workflows/black.yml
GhostOps77 Feb 1, 2023
8afa670
Dropped click version to 7: requirements/requirements.txt
GhostOps77 Feb 1, 2023
5429d54
switched to gh-actions: .travis.yml
GhostOps77 Feb 1, 2023
837dca5
run black on merge: .github/workflows/black.yml
GhostOps77 Feb 2, 2023
f4f5f4e
deleted: click_repl/__init__.py
GhostOps77 Feb 2, 2023
f284422
modified: tests/conftest.py
GhostOps77 Feb 2, 2023
8f2fc0f
Bumped min python version to 3.7
GhostOps77 Feb 2, 2023
a1dbe9e
Removed test on Py v3.6
GhostOps77 Feb 2, 2023
bd5c22b
Update tox.ini
GhostOps77 Feb 2, 2023
bb37752
Added gh actions test badge
GhostOps77 Feb 2, 2023
1208e40
modified: .github/workflows/tests.yml
GhostOps77 Feb 2, 2023
d865c01
modified: tox.ini
GhostOps77 Feb 2, 2023
316f156
Merge branch 'GhostOps77-patch-1' of https://github.com/GhostOps77/cl…
GhostOps77 Feb 2, 2023
7f973ca
Update tox.ini
GhostOps77 Feb 2, 2023
eb96240
Update setup.cfg
GhostOps77 Feb 2, 2023
9c485aa
Update requirements_dev.txt
GhostOps77 Feb 2, 2023
8baa63b
Updated tox
GhostOps77 Feb 2, 2023
c514449
imported annotations
GhostOps77 Feb 2, 2023
c187e3c
import future shifted to line 1
GhostOps77 Feb 2, 2023
a5c0b63
Update test_repl.py
GhostOps77 Feb 2, 2023
b2d61d7
Update test_repl.py
GhostOps77 Feb 2, 2023
535e840
Update test_repl.py
GhostOps77 Feb 2, 2023
c28ab26
Update test_repl.py
GhostOps77 Feb 2, 2023
5938abd
deleted: tests/conftest.py
GhostOps77 Feb 2, 2023
9f12dc0
Merge changes
GhostOps77 Feb 2, 2023
afd577c
modified: tests/test_repl.py
GhostOps77 Feb 2, 2023
cc20f80
modified: tests/test_repl.py
GhostOps77 Feb 2, 2023
2bbd9a1
modified: src/click_repl/utils.py
GhostOps77 Feb 2, 2023
8853350
Update utils.py
GhostOps77 Feb 2, 2023
dc91d86
modified: src/click_repl/utils.py
GhostOps77 Feb 2, 2023
dd3738a
Merge local changes to utils
GhostOps77 Feb 2, 2023
d4d7eac
modified: src/click_repl/utils.py
GhostOps77 Feb 2, 2023
76cec67
removed unused platform import: tests/test_repl.py
GhostOps77 Feb 2, 2023
0be7ac3
Added hyperlink to prompt-toolkit's github repo
GhostOps77 Feb 2, 2023
1c608e9
Merged pr #62: src/click_repl/utils.py
GhostOps77 Feb 2, 2023
bcb5c08
Merge branch 'GhostOps77-patch-1' of https://github.com/GhostOps77/cl…
GhostOps77 Feb 2, 2023
83df294
fixed failing case: tests/test_repl.py
GhostOps77 Feb 2, 2023
3190c76
Solved ubuntu's failing test: tests/test_repl.py
GhostOps77 Feb 2, 2023
3130372
modified: tests/test_repl.py
GhostOps77 Feb 2, 2023
c58f06e
removed unused platform module: tests/test_repl.py
GhostOps77 Feb 2, 2023
d8a383e
modified: .github/workflows/black.yml
GhostOps77 Feb 2, 2023
a1d1538
removed pypi hyperlink: README.md
GhostOps77 Feb 3, 2023
67151e7
modified: src/click_repl/utils.py
GhostOps77 Feb 3, 2023
070ce07
Updated: src/click_repl/utils.py
GhostOps77 Feb 3, 2023
980f9e9
Updated: src/click_repl/utils.py
GhostOps77 Feb 4, 2023
b907adf
modified: src/click_repl/utils.py
GhostOps77 Feb 4, 2023
d949ee6
modified for flake8 tests: src/click_repl/utils.py
GhostOps77 Feb 4, 2023
19aa747
removed a redundant test: tests/test_repl.py
GhostOps77 Feb 4, 2023
9171000
Added black : .github/workflows/black.yml
GhostOps77 Feb 5, 2023
68bed0d
Applied black formatter: .github/workflows/black.yml
GhostOps77 Feb 5, 2023
7010bca
modified: .github/workflows/black.yml
GhostOps77 Feb 5, 2023
907bb70
modified: .github/workflows/black.yml
GhostOps77 Feb 5, 2023
3644714
Format code with black
GhostOps77 Feb 5, 2023
f56f50c
modified: .github/workflows/black.yml
GhostOps77 Feb 5, 2023
6c2cd5f
Merge branch 'GhostOps77-patch-1' of https://github.com/GhostOps77/cl…
GhostOps77 Feb 5, 2023
2ce45bb
Format code with black
GhostOps77 Feb 5, 2023
2305889
renamed: .github/workflows/black.yml -> .github/workflows/formatt…
GhostOps77 Feb 5, 2023
48821c7
Merge branch 'GhostOps77-patch-1' of https://github.com/GhostOps77/cl…
GhostOps77 Feb 5, 2023
57679ff
Added subcommand invocation test: tests/test_command_collection.py
GhostOps77 Feb 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/formatter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Format code

on:
- push
- pull_request

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install -U pip
pip install black isort autoflake

- name: Format code with black
run: |
black src tests

- name: Sort imports with isort
run: |
isort src tests

- name: Remove unused imports with autoflake
run: |
autoflake --in-place --remove-all-unused-imports --remove-unused-variables --recursive .

- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: ${{ github.actor }}
author_email: ${{ github.actor }}@users.noreply.github.com
message: "Format code with black"
add: "src"
branch: ${{ github.ref }}
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
click-version: ['7.1.2', '8.1.2']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions click==${{ matrix.click-version }}
- name: Test with tox
run: tox
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ __pycache__/
*.py[cod]
*$py.class

#mypy cache
.mypy_cache

# C extensions
*.so

Expand Down
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
global-exclude *.py[cdo] __pycache__ *.so *.pyd
include LICENSE
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ release:
.PHONY: release

testrepl:
@python bin/testrepl.py repl
@python tests/testrepl.py repl
.PHONY: testrepl
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
click-repl
===

[![build](https://travis-ci.org/click-contrib/click-repl.svg?branch=master)](https://travis-ci.org/click-contrib/click-repl)
[![Tests](https://github.com/GhostOps77/click-repl/actions/workflows/tests.yml/badge.svg?branch=GhostOps77-patch-1)](https://github.com/GhostOps77/click-repl/actions/runs/4074019555/jobs/7018648133)
[![License](https://img.shields.io/pypi/l/click-repl?label=License)](https://github.com/GhostOps77/click-repl/blob/GhostOps77-patch-1/LICENSE)
![Python - version](https://img.shields.io/badge/python-3.6%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`.
98 changes: 0 additions & 98 deletions README.rst

This file was deleted.

25 changes: 0 additions & 25 deletions bin/testrepl.py

This file was deleted.

Loading