Output pretty command line text without hassle.
This is mostly a collection of pretty print commands
View the documentation here.
pip install cliasi
uv add cliasifrom cliasi import cli
cli.success("It works!")
# > ✔ [CLI] | It works!
cli.messages_stay_in_one_line = True
# The next few lines will get overwritten
cli.info("blah")
cli.warn("doing something dangerous")
# > ! [CLI] | doing something dangerousRead more about different message types and see visualizations in the documentation here.
One of the main features of cliasi is the ability to display animations while waiting for something to finish.
# File: examples/readme_demo.py
from cliasi import cli
# This will wait for three seconds and display an animation
task = cli.animate_message_non_blocking(
"Saving files...",
message_right="[CTRL-C to abort]",
messages_stay_in_one_line=True
)
do_stuff()
task.update("Files saved, waiting for process to quit", message_right="70%")
tell_process_to_quit()
task.stop()
cli.success("Process quit", message_right="100%")cliasi also catches exceptions and displays them in a pretty way. This then looks something like this:
# exception_message.py
import cliasi
# Importing cliasi automatically installs the logging handler
raise ValueError("An example error")Example CLI output (uncolored, see colored version in docs):
X [CLI] | Uncaught exception:
X [CLI] | Traceback (most recent call last):
| File "examples/exception_message.py", line 4, in <module>
| raise ValueError("An example error")
| ValueError: An example error
cliasi has many more features like:
- Logging integration
- Custom message alignments
- Customizable progressbars (with
PBCalculationMode) - And more!
This is just a fun project of mine mainly to try out python packaging. If you would like to contribute or have a feature-request, please open an issue or pull request.
