SmartFormatter

class lib.cli.args.SmartFormatter(prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None)

Bases: HelpFormatter

Extends the class argparse.HelpFormatter to allow custom formatting in help text.

Adapted from: https://stackoverflow.com/questions/3853722

Notes

Prefix help text with “R|” to override default formatting and use explicitly defined formatting within the help text. Prefixing a new line within the help text with “L|” will turn that line into a list item in both the cli help text and the GUI.

Methods Summary

add_argument(action)

add_arguments(actions)

add_text(text)

add_usage(usage, actions, groups[, prefix])

end_section()

format_help()

start_section(heading)

Methods Documentation

Parameters:
  • prog (str)

  • indent_increment (int)

  • max_help_position (int)

  • width (int | None)

add_argument(action)
add_arguments(actions)
add_text(text)
add_usage(usage, actions, groups, prefix=None)
end_section()
format_help()
start_section(heading)