Skip to content

Help

--help is colored by default when Rich is installed and stdout is a TTY. Opt out with Meta.help_formatter = RecursiveHelpFormatter. RichHelpMixin is optional (re-opt-in after a parent opt-out). Full walkthrough: Colored help.

from clak import Parser

class App(Parser):
    class Meta:
        help_description = "Hello [bold]World[/bold]"
        help_epilog = "See the docs."

    def cli_run(self, **_):
        return None

No CLI flags. Color follows TTY stdout, NO_COLOR, CLAK_COLORS, and CLAK_COLOR_BACKEND. Install Rich with pip install 'mrjk.clak[markdown]'.

clak.comp.help

Rich-colored --help (default formatter; opt out via Meta).

RichRecursiveHelpFormatter is the Parser default marker for colored help. Layout lives in HelpRenderer. Color follows NO_COLOR, CLAK_COLORS, CLAK_COLOR_BACKEND, TTY stdout, and whether Rich is importable. Missing Rich degrades to plain HelpRenderer layout (no ANSI).

RichHelpMixin

Same default as Parser (Rich help formatter).

Optional. Useful to re-opt-in a child after a parent sets Meta.help_formatter = RecursiveHelpFormatter.

RichRecursiveHelpFormatter

Bases: RecursiveHelpFormatter

Marker: same layout as RecursiveHelpFormatter, with Rich color.

help_uses_rich()

Whether --help should emit ANSI.