interactive_cli
interactive_cli usage
This module allows to create programs that show an interactive command line interface. The program waits for the user input and then acts on user interaction.
Example:
from interactive_cli.blocking_cli_app import BlockingCLIApp
from interactive_cli.cli_command import CLICommand
if __name__ == "__main__":
app = BlockingCLIApp("Hello world CLI")
app.add_command(
CLICommand("say hello world", lambda app, page: app.print("Hello world"))
)
app.start()
results in
Hello world CLI
===============
Use 'help' to get a detailed list of commands.
Enter command [h,q,s]:
More examples are included in the example directory.
Installation
Via pip
pip install interactive_cli
From source
To run this program from the code directly, python and poetry (pip install poetry) are required. Clone or download the repository.
To install all the dependencies, use your command line and navigate to the directory where this README file is located in. Then run
poetry install
For development
For development installation perform the From source installation.
For installing new packages, always run
poetry add <pip-package-name>
instead of pip install <pip-package-name>.
Launch the program either check out the Execution section or use the Run and Debug-side panel of VSCode.
If the interpreter of the virtual environment does not show up in VSCode, add it manually. The virtual environments are located in {cache-dir}/virtualenvs/<venv-name>/Scripts/python.exe where the {cache-dir} depends on the operating system (~/.cache/pypoetry, ~/Library/Caches/pypoetry or C.\Users\%USERNAME%\AppData\Local\pypoetry\Cache).
Execution
To execute the program use
poetry run python -m interactive_cli
Metadata
Release files for interactive-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| interactive_cli-0.1.0.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| interactive_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / interactive_cli-0.1.0.tar.gz
| Download URL | interactive_cli-0.1.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e60978f7b32841eb9e2bd32347dc056c43344bdfcff79e6f07ec91553093b5e6
|
|
BLAKE2b-256 checksum How to use checksums |
d5feff343f410676b2bdbfdc87ac640d7472fd5e9cfb70ae5fe4436235ec4e77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.16 Windows/10
|
Release files / interactive_cli-0.1.0-py3-none-any.whl
| Download URL | interactive_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87df8a390431e4ccfabfce66a862d34902f03cee77b26ac1aba916caee8c5c75
|
|
BLAKE2b-256 checksum How to use checksums |
ca958334d643aecdf12f0a1ff9a24442bfad406985229933eab7315b3dc787db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.16 Windows/10
|