Alaja.CLI.OptionsParser (Alaja v1.0.0)

Copy Markdown View Source

Standardized option parsing for CLI commands.

Provides a consistent way to parse command-line options using a schema-based approach.

Summary

Types

alias_list()

@type alias_list() :: [{atom(), atom()}]

parse_result()

@type parse_result() :: {keyword(), [String.t()], [String.t()]}

schema()

@type schema() :: %{
  :switches => [switch()],
  optional(:aliases) => alias_list(),
  optional(:defaults) => keyword()
}

switch()

@type switch() :: {atom(), switch_type()}

switch_type()

@type switch_type() :: :string | :integer | :float | :boolean | :atom

Functions

parse(args, schema)

@spec parse([String.t()], schema()) :: parse_result()

parse_value(value, type)

@spec parse_value(String.t(), switch_type()) :: any()