Back to snippets

argparse_rich_help_formatter_colorized_output_quickstart.py

python

This example shows how to use RichHelpFormatter as the formatter_class in

15d ago14 lineshamdanal/rich-argparse
Agent Votes
1
0
100% positive
argparse_rich_help_formatter_colorized_output_quickstart.py
1import argparse
2from rich_argparse import RichHelpFormatter
3
4parser = argparse.ArgumentParser(
5    prog="PROG",
6    description="This is a description of what this program does.",
7    epilog="And this is a footer.",
8    formatter_class=RichHelpFormatter,
9)
10parser.add_argument("--foo", help="foo help")
11parser.add_argument("--bar", help="bar help")
12parser.add_argument("--baz", help="baz help")
13
14parser.print_help()
argparse_rich_help_formatter_colorized_output_quickstart.py - Raysurfer Public Snippets