Skip to main content

A python package which adds simple cli tools to your python project.

Project description

Python clitools

This package removes annoying boilerplate code that you will see you write yourself over and over again to create a pleasant cli-centered user interface.

Installation

For more information, check out the PyPi page

to install the newest version, use:

pip install JefvdA-python-clitools

Tools

The tools are methods that are used most-often.
These include:

  • clear() -> OS independant method to clear the terminal
  • wait_for_enter() -> method to wair for user input before continuing, clears the screen after
  • get_user_input() -> method to returns user input. This method formats the text printed for the input to add " >>> " after it. Example: "What is your name?", becomes, "What is your name? >>> "

Menu

A "Menu" class that makes it very easy to display a menu in the terminal, and have different results for all the options the user can choose from.

When initiating a new "Menu" object, make sure to pass it all the options, aswell as their corresponding fucntions.
Example:

menu_options = {
    "Hello world": say_hello_world,
    "Greet by name": ask_for_name,
    "Get random number": get_random_number,
    "Exit": exit
}
menu = Menu(menu_options)

When a "Menu" option is created, it can be displayed with the "show()" method.

menu.show()

This will only run the menu once, if you wish to keep displaying the menu. Wrap the "show" in a while loop + add an option to exit the program

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

JefvdA_python_clitools-0.0.3.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

JefvdA_python_clitools-0.0.3-py3-none-any.whl (4.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