Skip to main content

page

Function page 

Source
pub fn page(
    spec: &Spec<'_>,
    root: &Command<'_>,
    argv: &[&OsStr],
    cmd: &Command<'_>,
    page: Page,
    style: Style,
) -> Option<String>
Expand description

The page a help request becomes, by the route the words took.

The parser reports the command a request arrived at, but a page is about the route that reached it: one Subcommands type mounted under two parents is one address, and a page found by searching for that address carries the first mount’s path and globals. Falls back to rendering by address where the route cannot be rebuilt, which only a command from another CLI’s tables can reach.

One function rather than a shape each caller reassembles. parse() renders a request this way, and so does anything that wants to know what a command line would have printed without running the program — a test harness, most of all, since a page it renders differently from the process is a page that proves nothing.