class HelpFormatter: (source)
This class helps with formatting text-based help pages. It's usually just needed for very special internal cases, but it's also exposed so that developers can write their own fancy outputs. At present, it always writes into memory. :param indent_increment: the additional increment for each level. :param width: the width for the text. This defaults to the terminal width clamped to a maximum of 78.
Method | __init__ |
Undocumented |
Method | dedent |
Decreases the indentation. |
Method | getvalue |
Returns the buffer contents. |
Method | indent |
Increases the indentation. |
Method | indentation |
A context manager that increases the indentation. |
Method | section |
Helpful context manager that writes a paragraph, a heading, and the indents. |
Method | write |
Writes a unicode string into the internal buffer. |
Method | write |
Writes a definition list into the buffer. This is how options and commands are usually formatted. |
Method | write |
Writes a heading into the buffer. |
Method | write |
Writes a paragraph into the buffer. |
Method | write |
Writes re-indented text into the buffer. This rewraps and preserves paragraphs. |
Method | write |
Writes a usage line into the buffer. |
Instance Variable | buffer |
Undocumented |
Instance Variable | current |
Undocumented |
Instance Variable | indent |
Undocumented |
Instance Variable | width |
Undocumented |
Undocumented
Parameters | |
indentint | Undocumented |
width:t.Optional[ | Undocumented |
maxt.Optional[ | Undocumented |
Helpful context manager that writes a paragraph, a heading, and the indents. :param name: the section name that is written as heading.
Parameters | |
name:str | Undocumented |
Returns | |
t.Iterator[ | Undocumented |
Writes a definition list into the buffer. This is how options and commands are usually formatted. :param rows: a list of two item tuples for the terms and values. :param col_max: the maximum width of the first column. :param col_spacing: the number of spaces between the first and second column.
Parameters | |
rows:t.Sequence[ | Undocumented |
colint | Undocumented |
colint | Undocumented |
Writes re-indented text into the buffer. This rewraps and preserves paragraphs.
Parameters | |
text:str | Undocumented |
Writes a usage line into the buffer. :param prog: the program name. :param args: whitespace separated list of arguments. :param prefix: The prefix for the first line. Defaults to ``"Usage: "``.
Parameters | |
prog:str | Undocumented |
args:str | Undocumented |
prefix:t.Optional[ | Undocumented |