{"library":"rich-argparse","code":"import argparse\nfrom rich_argparse import RichHelpFormatter\n\nparser = argparse.ArgumentParser(\n    description='A command-line tool with \\n[bold blue]rich[/bold blue] help formatting.',\n    formatter_class=RichHelpFormatter\n)\n\nparser.add_argument('--name', '-n', help='Your name.')\nparser.add_argument('--age', '-a', type=int, help='Your age.')\nparser.add_argument(\n    '--verbose', '-v', action='store_true', \n    help='[dim]Enable verbose output.[/dim]'\n)\n\n# To display the rich help, you would typically run your script with --help\n# or allow argparse to display it on invalid input.\n# For demonstration, we can try parsing arguments that trigger help:\n# try:\n#     parser.parse_args(['--help'])\n# except SystemExit: # argparse raises SystemExit on --help\n#     pass\n\n# To simply see the formatted output in a script context:\n# This will print the help to the console\nparser.print_help()\n","lang":"python","description":"This quickstart demonstrates how to apply `RichHelpFormatter` to an `argparse.ArgumentParser` instance. It showcases rich markup directly within the description and help messages, which `RichHelpFormatter` will render beautifully in the terminal when `parser.print_help()` is called or `--help` is invoked.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}