Args module

help_text

procedureextensionSource

The help text of the whole program (what --help prints), for tools that show it themselves.

Example↗
Args :: #import "Extensions/Args";

Cli :: struct { verbose: bool; @short=v }
HELP :: Args.Help(Cli).{ about = "Does things.", verbose = "Talk more" };

text := Args.help_text(Cli, HELP, "tool");
assert(text.count > 0);
help_text :: ($T: Type, $help: Help(T), program := "", color := false) -> string

The help text of the whole program (what --help prints), for tools that show it themselves.

Parameters

$T: Type
the struct whose fields are the options.
$help: Help(T)
the help strings for T.
program := ""
the name shown in the usage line; "" uses argv[0]'s basename.
color := false
whether to include ANSI colour codes.

Returns

string
Example↗
Args :: #import "Extensions/Args";

Cli :: struct { verbose: bool; @short=v }
HELP :: Args.Help(Cli).{ about = "Does things.", verbose = "Talk more" };

text := Args.help_text(Cli, HELP, "tool");
assert(text.count > 0);

See also