Help

help_text : CliConfig, List Str, TextStyle -> Str

Render the help text for a command at or under the root config.

The second argument should be a list of subcommand names, e.g. ["example", "subcommand-1", "subcommand-2"]. If the subcommand isn't found, the root command's help page is rendered by default.

example_cli =
    Opt.count { short: "v", help: "How verbose our logs should be." }
    |> Cli.finish {
        name: "example",
        version: "v0.1.0",
        description: "An example CLI.",
    }
    |> Cli.assert_valid

expect
    help_text example_cli.config ["example"]
    ==
        """
        example v0.1.0

        An example CLI.

        Usage:
          example -v [OPTIONS]

        Options:
          -v             How verbose our logs should be.
          -h, --help     Show this help page.
          -V, --version  Show the version.
        """

usage_help : CliConfig, List Str, TextStyle -> Str

Render just the usage text for a command at or under the root config.

The second argument should be a list of subcommand names, e.g. ["example", "subcommand-1", "subcommand-2"]. If the subcommand isn't found, the root command's usage text is rendered by default.

example_cli =
    Opt.count { short: "v", help: "How verbose our logs should be." }
    |> Cli.finish {
        name: "example",
        version: "v0.1.0",
        description: "An example CLI.",
    }
    |> Cli.assert_valid

expect
    help_text example_cli.config ["example"]
    ==
        """
        Usage:
          example -v [OPTIONS]
        """