Prompt.Router.ArgSpec (prompt v0.12.0)

View Source

One argument of a router command, built by Prompt.Router.arg/3 or Prompt.Router.positional/3. Read it in an override of Prompt.Router.command_help/1; do not build it by hand.

Fields:

  • :name - the atom key the parsed value is stored under. A flag is typed with dashes, so :dry_run is --dry-run.
  • :type - :boolean, :string, :integer, or :float.
  • :kind - :flag for --name options, :positional for bare values.
  • :short - the one letter alias of a flag, or nil.
  • :default - the value used when a flag is not given, or nil.
  • :required - whether the argument must be given.
  • :in - the allowed values, or nil for any value.
  • :multiple - whether a positional collects all remaining values.
  • :doc - the description shown in usage, or nil.

Summary

Types

t()

@type t() :: %Prompt.Router.ArgSpec{
  default: term(),
  doc: String.t() | nil,
  in: list() | nil,
  kind: :flag | :positional,
  multiple: boolean(),
  name: atom(),
  required: boolean(),
  short: atom() | nil,
  type: :boolean | :string | :integer | :float
}