error-helper

Minimalistic python module to print colorful messages


Keywords
cli, colors, python, python3
License
MIT
Install
pip install error-helper==1.0

Documentation

pypi python mit

error-helper

This is a minimalistic python module which helps you print colorful messages for CLI tools. It's available on PyPi, but you can also add it to your project as a git submodule.

Usage

>>> from error_helper import *
>>> info("this is information")                    # output will be blue
this is information
>>> hint("this is less important information")     # output will be grayed out
this is less important information
>>> warning("something didn't go quite right...")  # output will be yellow
warning: something didn't go quite right...
>>> error("something went terribly wrong")         # output will be red
error: something went terribly wrong
>>> success("completed the operation!")            # output will be green
successfully completed the operation!

prompt(...) and prompt_input(...)

The prompt(...) function, by default, prints a newline, followed by the provided values, a colon and another newline:

>>> prompt("enter the server url")

enter the server url:
>>>

The prompt_input(...) function, by default, prints the provided values, followed by a colon and a space. Then it calls the default input(...) function and returns it's result. The result will be stripped if strip=True (default).

>>> prompt("enter the server url"); url = prompt_input("url:")

enter the server url:
url:  https://30350n.de
>>> url
'https://30350n.de'