Skip to content

formatHelp

Generated reference page for the formatHelp function export.

Signatures

ts
function formatHelp(schema: CommandSchema, options?: HelpOptions): string;
ParameterTypeDescription
schemaCommandSchemaThe command schema to render help for.
optionsHelpOptions | undefinedFormatting options (width, binary name).

Members

Members

formatHelp

Generate help text from a command schema.

Low-level formatter: most applications reach this through --help, help <command>, or root help rendering in CLIBuilder. Call formatHelp() directly when embedding DreamCLI help text into custom UIs, tests, or generated docs.

Sections rendered (in order):

  1. Usage line — program <command> [flags] <args>
  2. Description — the command's .description() text
  3. Commands — subcommands table (if any, skips hidden)
  4. Arguments — positional args table (if any)
  5. Flags — flags table with type hints and defaults
  6. Examples — usage examples (if any)
ts
(schema: CommandSchema, options?: HelpOptions): string;

Examples

ts
const text = formatHelp(deploy.schema, { binName: 'mycli' });

See Also

Released under the MIT License.