Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more functions #44

Open
dmerejkowsky opened this issue Mar 5, 2020 · 2 comments
Open

Add more functions #44

dmerejkowsky opened this issue Mar 5, 2020 · 2 comments

Comments

@dmerejkowsky
Copy link
Collaborator

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 hr which 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 ?

@greysign
Copy link

bro, coool library, nice job

@dmerejkowsky
Copy link
Collaborator Author

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

dmerejkowsky added a commit that referenced this issue May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants