Prompt.Router.Usage (prompt v0.12.0)
View SourceGenerates usage text for routers and commands from their specs.
Inside each section of a command's usage, Arguments and Options separately,
every label is padded to the longest label of that section plus 4 spaces.
Summary
Functions
Usage text for one command. path is the list of command words typed after
the app name, for example ["import"] or ["categories", "add"]; the
fallback command passes []. A command with subcommands lists them under
Commands:, and a group (no module) shows <command> in its usage line.
The @moduledoc text of module, or nil when docs are not available.
Usage text for a router: its top-level commands with the first line of each command module's moduledoc, when docs are available.
Functions
@spec command(atom() | nil, [String.t()], Prompt.Router.CommandSpec.t()) :: String.t()
Usage text for one command. path is the list of command words typed after
the app name, for example ["import"] or ["categories", "add"]; the
fallback command passes []. A command with subcommands lists them under
Commands:, and a group (no module) shows <command> in its usage line.
The @moduledoc text of module, or nil when docs are not available.
@spec router(atom() | nil, [Prompt.Router.CommandSpec.t()]) :: String.t()
Usage text for a router: its top-level commands with the first line of each command module's moduledoc, when docs are available.