I have a question that's somewhat similar to this SO Q&A, however I want to add additional blank lines to an epilog at the end of the output generated by click.
I have the following code:
EPILOG='\n' + '-' * 20
class SpecialEpilog(click.Group):
def format_epilog(self, ctx, formatter):
if self.epilog:
formatter.write_paragraph()
for line in self.epilog.split('\n'):
formatter.write_text(line)
#------------------
@click.group(cls=SpecialEpilog, epilog=EPILOG, invoke_without_command=True)
def cli():
"""Wraps cloud.tenable.com Nessus API calls in useful ways
\b
The CLI provides access to these subcommands:
- agent
- os
- vuln
Each subcommand can perform useful API queries within their respective domain.
"""
pass
#------------------
# main
cli.add_command(os)
cli.add_command(agent)
cli.add_command(vuln)
This produces the following usage output:
Usage: nessus_query [OPTIONS] COMMAND [ARGS]...
Wraps cloud.tenable.com Nessus API calls in useful ways
The CLI provides access to these subcommands:
- agent
- os
- vuln
Each subcommand can perform useful API queries within their respective
domain.
Options:
--help Show this message and exit.
Commands:
agent API calls focusing on assets' details - Works...
os API calls focusing on operating systems -...
vuln API calls focusing on vulnerabilities - Works...
--------------------
$ myprompt>
My question:
I cannot figure out a method which doesn't require printable characters. If I remove the dash sequence above, the newline characters (\n
) no longer get displayed. In other words the above usage goes to this:
...
Commands:
agent API calls focusing on assets' details - Works...
os API calls focusing on operating systems -...
vuln API calls focusing on vulnerabilities - Works...
$ myprompt>