Help v0.1.0
Writing the help, usage and version text generated from a specification.
WriteUsage
pub func WriteUsage(
spec: &CommandSpec,
writer: &var TextWriter,
parent: char8[..]
) -> ! FormatError
Writes the usage line, such as Usage: tool [options] <input> [output].
parent names the command a subcommand belongs to, so that its usage reads tool build ...; it is empty for the
program itself. Reports whatever the writer reported.
Parameters
| Name | Type | Description |
|---|---|---|
spec | &CommandSpec | the command |
writer | &var TextWriter | the destination |
parent | char8[..] | the name of the command this one is a subcommand of, or empty |
Returns: success when the whole line was accepted
WriteHelp
pub func WriteHelp(
spec: &CommandSpec,
writer: &var TextWriter,
parent: char8[..]
) -> ! FormatError
Writes the full help text: the summary, the usage line, and the arguments, options and subcommands with their descriptions aligned. Reports whatever the writer reported. Allocates nothing.
Parameters
| Name | Type | Description |
|---|---|---|
spec | &CommandSpec | the command |
writer | &var TextWriter | the destination |
parent | char8[..] | the name of the command this one is a subcommand of, or empty |
Returns: success when the whole text was accepted
WriteVersion
pub func WriteVersion(
spec: &CommandSpec,
writer: &var TextWriter
) -> ! FormatError
Writes the version line, such as tool 1.4.2.
Reports whatever the writer reported.
Parameters
| Name | Type | Description |
|---|---|---|
spec | &CommandSpec | the command |
writer | &var TextWriter | the destination |
Returns: success when the whole line was accepted