Skip to main content

render_for_args

Function render_for_args 

Source
pub fn render_for_args(args: &[&str]) -> Option<String>
Expand description

Render the help that heddle <args> would print, in-process, for the help-shaped argv forms — without spawning the binary.

args is the argv after the program name (e.g. ["clone", "--help"], ["help", "threads"], ["capture", "--help-agent"]). Returns Some(text) with the exact bytes the binary writes to stdout for that request, or None when the argv is not a pure help request this renderer serves (the caller should fall back to spawning the binary).

This mirrors main.rs’s help-dispatch routing precisely: the bare-help intercept, the heddle <path> --help pre-parse, the capture --help-agent reveal, and the heddle help <topics> arm. Because the underlying printers are now write_stdout(&render_*(..)) wrappers, the in-process text is byte-identical to the spawned binary’s stdout — only the execution mechanism differs (HeddleCo/heddle#381). Help is repo-, cwd-, and env-independent, so this is safe to call from parallel tests.