Prompt.Router.CommandSpec (prompt v0.12.0)

View Source

One command of a router, built by Prompt.Router.command/2 and Prompt.Router.command/3. It is passed to Prompt.Router.command_help/1 and to Prompt.Router.Usage; do not build it by hand.

Fields:

  • :name - the command word as an atom or string, "" for the fallback command.
  • :module - the Prompt.Command module that runs it, or nil for a group that only holds subcommands.
  • :args - the Prompt.Router.ArgSpec structs of its flags and positionals, in definition order.
  • :subcommands - nested CommandSpec structs, in definition order.
  • :parents - the command words typed before this command's name, for example ["categories"] for categories add. [] at the top level.

Summary

Types

t()

@type t() :: %Prompt.Router.CommandSpec{
  args: [Prompt.Router.ArgSpec.t()],
  module: module() | nil,
  name: atom() | String.t(),
  parents: [String.t()],
  subcommands: [t()]
}