JustBash.CLI.Help (JustBash v0.4.0)

View Source

Renders --help text, usage lines, and usage errors for a JustBash.CLI.

All output is derived purely from the CLI's declarative spec, so help can never drift from runtime behavior. Output format is consistent across every CLI built on the feature — which is the point: agents recover from a typo or a missing flag in one turn because the error always carries a usage line and (for unknown commands) a suggestion.

Summary

Functions

Full --help text for a group node (the CLI root or a %Command{} group).

Full --help text for a leaf command.

Error text for a group invoked without a subcommand: a message plus the group's command listing.

Error text for an unknown subcommand: a message, a "did you mean" suggestion when one is close enough, and a pointer to --help.

The one-line Usage: string for a leaf, used both in --help and in usage errors.

Functions

group_help(cli, path, group)

@spec group_help(JustBash.CLI.t(), [String.t()], struct()) :: String.t()

Full --help text for a group node (the CLI root or a %Command{} group).

path is the subcommand path to the group ([] for the root).

leaf_help(cli, path, leaf)

@spec leaf_help(JustBash.CLI.t(), [String.t()], JustBash.CLI.Command.t()) ::
  String.t()

Full --help text for a leaf command.

missing_subcommand(cli, path, group)

@spec missing_subcommand(JustBash.CLI.t(), [String.t()], struct()) :: String.t()

Error text for a group invoked without a subcommand: a message plus the group's command listing.

unknown_subcommand(cli, path, group, token)

@spec unknown_subcommand(JustBash.CLI.t(), [String.t()], struct(), String.t()) ::
  String.t()

Error text for an unknown subcommand: a message, a "did you mean" suggestion when one is close enough, and a pointer to --help.

usage_line(cli, path, leaf)

@spec usage_line(JustBash.CLI.t(), [String.t()], JustBash.CLI.Command.t()) ::
  String.t()

The one-line Usage: string for a leaf, used both in --help and in usage errors.