View Source Clik.Command behaviour (Clik v0.2.1)
Link to this section Summary
Functions
Fetch command implementation's help blurb.
Creates a new Clik.Command
instance.
Creates a new Clik.Command
instance.
Fetch list of command-specific options.
Executes a command.
Link to this section Types
@type option_map() :: %{} | %{required(atom()) => Clik.Option.t()}
List of command options
@type result() :: :ok | {:error, atom()}
An executable command
Link to this section Callbacks
@callback help_text() :: String.t() | nil
Returns short help blurb
@callback options() :: option_map()
Returns list of command-specific options
@callback run(Clik.CommandEnvironment.t()) :: result()
Executes the command
Link to this section Functions
Fetch command implementation's help blurb.
Creates a new Clik.Command
instance.
Returns {:error, :badarg}
if:
name
orcallback_module
are nil- Loading
callback_module
viaCode.ensure_loaded/1
fails
Creates a new Clik.Command
instance.
Raises ArgumentError
if:
name
orcallback_module
are nil- Loading
callback_module
viaCode.ensure_loaded/1
fails
@spec options(t()) :: option_map()
Fetch list of command-specific options.
@spec run(t(), Clik.CommandEnvironment.t()) :: result()
Executes a command.