No project description provided
Project description
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_app import CLIApp
from interactive_cli.cli_command import CLICommand
def _hello_world(app: CLIApp) -> None:
app.print("Hello world!")
if __name__ == "__main__":
app = BlockingCLIApp("Hello world CLI", "flow")
app.add_command(CLICommand("say hello world", _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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for interactive_cli-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9694ddd6f367228be1e052a5b531e8281400fefb640105e176b5ff8b3cea14d |
|
MD5 | 52cf32c031bd7aa469ade74d04783d41 |
|
BLAKE2b-256 | ca4837f651ee3a180fccdfd69ce8d8e3a9a3053f13f9b022773446f3ba49f4fb |