I am using a library called click
for making command line apps and to define the description the code looks like this
def cli:
""" Description goes here """
So all's well and good until I try to have multiple lines.
Naturally I tried this
def cli:
""" hi
hi
hi"""
But this doesnt end well. The text gets pushed all over the place and doest look good. I tried adding \n after each line but it just added to big a space where the output ended up looking like this:
Output:
hi
hi
hi
This reason this can't happen is I have ascii art that needs the lines to be close together.
The issue with your second attempt is that the line starts from the first """
and then includes all text (including whitespace) until the next """
. So, when you do this:
def cli:
""" hi
hi
hi"""
You have 1 space before the first 'hi' and then 9 spaces before the next one. The solution is to either drop the first line down one line, or just remove 8 spaces before the other lines. This should have consistent indentation for each 'hi' when it gets printed:
def cli:
return """
\b
hi
hi
hi"""
EDIT: Apparently click reformats text before it prints it, but according to the docs adding \b
should disable that behaviour.