Help Rendering

Drop-in argparse HelpFormatter using Kida templates.

1 min read 192 words

Milo providesHelpRenderer, a drop-in argparse.HelpFormattersubclass that renders help output through Kida templates for styled terminal output.

Usage

import argparse
from milo import HelpRenderer

parser = argparse.ArgumentParser(
    prog="myapp",
    description="My CLI tool",
    formatter_class=HelpRenderer,
)
parser.add_argument("--verbose", help="Enable verbose output")
parser.add_argument("command", help="Command to run")
parser.parse_args()

When the user runs myapp --help, the output is rendered through the help.kidaKida template instead of argparse's default plain-text formatter.

Customization

Override the built-inhelp.kidatemplate by placing your own in your template directory. The template receives the full argparse structure as context.

Fallback

Note

If template rendering fails for any reason,HelpRendererfalls back to the default argparse formatting silently. Your CLI will always show help — it just won't be styled.