Skip to main content

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_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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interactive_cli-0.1.0.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

interactive_cli-0.1.0-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page