View Source Clik.Configuration (Clik v0.2.1)
Collects commands and global options.
Link to this section Summary
Functions
Add a command to the application configuration.
Add a command to the application configuration.
Add a global option to the application configuration.
Add a global option to the application configuration.
Look up Clik.Command
by name.
Look up Clik.Command
by name.
Does the configuration contain a named command?
Creates a new Clik.Configuration
instance
Fetch complete set of options for a given named command.
Fetch complete set of options for a given named command.
Link to this section Types
@type t() :: %Clik.Configuration{ commands: %{required(atom()) => Clik.Command.t()}, global_options: %{required(atom()) => Clik.Option.t()}, has_default: boolean(), script_help: term() }
Global CLI app configuration
Link to this section Functions
@spec add_command(t(), Clik.Command.t()) :: {:ok, t()} | {:error, :duplicate_command} | {:error, :duplicate_option, Clik.Option.t()}
Add a command to the application configuration.
Returns {:error, :duplicate_command}
or {:error, :duplication_option, option}
on error.
@spec add_command!(t(), Clik.Command.t()) :: t() | no_return()
Add a command to the application configuration.
Raises Clik.DuplicateCommandNameError
or Clik.DuplicateOptionError
on error.
@spec add_global_option(t(), Clik.Option.t()) :: {:ok, t()} | {:error, :duplicate}
Add a global option to the application configuration.
Returns {:error, :duplicate} on error.
@spec add_global_option!(t(), Clik.Option.t()) :: t() | no_return()
Add a global option to the application configuration.
Raises Clik.DuplicateOptionError
on error.
@spec command(t(), atom()) :: {:ok, Clik.Command.t()} | {:error, :unknown_command}
Look up Clik.Command
by name.
Returns {:error, :unknown_command} if name
is not found.
@spec command!(t(), atom()) :: Clik.Command.t() | no_return()
Look up Clik.Command
by name.
Raises Clik.UnknownCommandNameError
if name
is not found.
Does the configuration contain a named command?
Creates a new Clik.Configuration
instance
@spec options(t(), atom()) :: {:ok, %{required(atom()) => Clik.Option.t()}} | {:error, :unknown_command}
Fetch complete set of options for a given named command.
The complete set of options includes options specific to the command and global options.
Returns {:error, :unknown_command}
when command name is not found.
@spec options!(t(), atom()) :: %{required(atom()) => Clik.Option.t()} | no_return()
Fetch complete set of options for a given named command.
See Clik.Configuration.options/2
for more information.
Raises Clik.UnknownCommandNameError
when command not found.