This example:
import click
@click.group()
def cli():
"""Top-level spam."""
pass
@cli.command()
def eggs():
"""Second-level spam: spam, spam, spam, spam, spam, spam! Lovely spam!
Wonderful spam! Lovely spam! Wonderful spam!
"""
pass
if __name__ == '__main__':
cli()
used together with Click 6.2, will produce:
$ python click_test.py
Usage: clitest.py [OPTIONS] COMMAND [ARGS]...
Top-level spam.
Options:
--help Show this message and exit.
Commands:
eggs Second-level spam: spam, spam, spam, spam,...
Notice ellipsis in the end and truncated help for eggs command - it was made by Click, not by me.
How to avoid that?
Hi you can pass the help text as short_help like
@cli.command(short_help="Second-level spam: spam, spam, spam, spam, spam, spam! Lovely spam!
Wonderful spam! Lovely spam! Wonderful spam!")
I came across the same issue. I was checking the code and if a short_help is not defined it restrict the help length to 45 characters. If it is longer than 45 it adds the ellipsis in the end and truncate the string.
Why is it defined to 45 characters ?
Also, if it has to restrict to 45 characters, wouldn't be short_help instead of help ?
It looks like the purpose of help and short_help are inverted.
@mitsuhiko While this was closed more than 4 years ago, I cannot ask myself why it was closed without any explanation as it clearly looks like a valid bug in click.
The current behavior of click regarding help and short_help seems just wrong.
Not only this but the implicit conversion of docstrings __doc__ to censored help makes no sense as docstrings are likely multiline and longer than 45 chars.
Was anyone able to find a solution for them?
Most helpful comment
I came across the same issue. I was checking the code and if a short_help is not defined it restrict the help length to 45 characters. If it is longer than 45 it adds the ellipsis in the end and truncate the string.
Why is it defined to 45 characters ?
Also, if it has to restrict to 45 characters, wouldn't be short_help instead of help ?
It looks like the purpose of help and short_help are inverted.