The way the Base classes format help is determined by a help formatter class. By changing a base’s help_formatter attribute, you can make it display help in a different way.
All help formatters should subclass from BaseHelpFormatter.
HelpFormatters are constructed with a stream. They should format the help when certain methods are called. Note that BaseHelpFormatter itself does not implement these methods, but HelpFormatter does.
Parameters: |
|
---|
This will decrease the current indentation level by indent_by spaces.
Raises: | RuntimeError if you try to dedent past 0. |
---|
This writes the given data to the stream. Under normal circumstances, the data printed will be indented to the current indentation level.
Parameters: |
---|
The HelpFormatter class has some sensible defaults for formatting help. It’s not the nicest looking help ever, but it works. If you want indented sections, you can use the IndentedHelpFormatter class. The ANSIHelpFormatter uses ANSI boldface effects on section titles and usage strings.
Of course, you can always implement your own help formatters.