python-cli-ui
python-cli-ui copied to clipboard
Add more functions
I often end up needed those in projects that depend on cli-ui, so might as well add them here.
First, h1, h2 and h3:
h1("Section")
h2("Sub section")
h2("Sub sub section")
Section
=======
Sub section
--------------
Sub sub section
+++++++++++++
- Then
hrwhich would print an horizontal line taking all of the horizontal space
info("foo")
hr()
foo
-----------------------------------------------
I'm open to suggestions regarding naming (re-using HTML syntax may not be the best idea)
Also, maybe we need h3 to h6 ?
bro, coool library, nice job
Other idea. Have a way to log multiple messages on the same line:
def erase_last_line() -> None:
terminal_size = shutil.get_terminal_size()
ui.info(" " * terminal_size.columns, end="\r")
ui.info("doing stuff", end="\n")
# ...
erase_last_line()
It's a pattern I've been using a few times