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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file interactive_cli-0.1.0.tar.gz.

File metadata

  • Download URL: interactive_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.9.16 Windows/10

File hashes

Hashes for interactive_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e60978f7b32841eb9e2bd32347dc056c43344bdfcff79e6f07ec91553093b5e6
MD5 52af1b892092da29b55f5b0148c3b885
BLAKE2b-256 d5feff343f410676b2bdbfdc87ac640d7472fd5e9cfb70ae5fe4436235ec4e77

See more details on using hashes here.

File details

Details for the file interactive_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for interactive_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87df8a390431e4ccfabfce66a862d34902f03cee77b26ac1aba916caee8c5c75
MD5 fa73c04322a860f2e96a23d7a883b1ae
BLAKE2b-256 ca958334d643aecdf12f0a1ff9a24442bfad406985229933eab7315b3dc787db

See more details on using hashes here.

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