View Source Clik.Option (Clik v0.2.1)

Configurable CLI flag.

Link to this section Summary

Types

Individual options used to configure an instance of Clik.Option

Valid option types

Valid option value types

Set of configuration options used to configure an instance of Clik.Option

t()

Struct corresponding to a single CLI flag or switch

Functions

Creates a new Clik.Option instance.

Creates a new Clik.Option instance.

Link to this section Types

@type error() :: {:error, atom()}
@type opt() ::
  {:default, option_value()}
  | {:help, String.t()}
  | {:hidden, boolean()}
  | {:long, atom()}
  | {:required, boolean()}
  | {:short, atom()}
  | {:type, option_type()}

Individual options used to configure an instance of Clik.Option

@type option_type() :: :float | :integer | :string | :boolean | :count

Valid option types

@type option_value() :: float() | integer() | String.t() | boolean()

Valid option value types

@type opts() :: [] | [opt()]

Set of configuration options used to configure an instance of Clik.Option

@type t() :: %Clik.Option{
  default: option_type() | nil,
  help: String.t(),
  hidden: boolean(),
  long: atom(),
  name: term(),
  required: boolean(),
  short: atom(),
  type: option_type()
}

Struct corresponding to a single CLI flag or switch

Link to this section Functions

Link to this function

new(name, opts \\ [])

View Source (since 0.1.0)
@spec new(atom(), opts()) :: {:ok, t()} | error()

Creates a new Clik.Option instance.

Returns {:ok, t} or {:error, reason}.

@spec new!(atom(), opts()) :: t() | no_return()

Creates a new Clik.Option instance.

Raises ArgumentError on error.