View Source Optimus (optimus v0.4.0)

Link to this section Summary

Link to this section Types

@type arg_spec_item() :: {name :: atom(), [arg_spec_param()]}
@type arg_spec_param() ::
  {:value_name, String.t()}
  | {:help, String.t()}
  | {:required, boolean()}
  | {:parser, parser()}
@type custom_parser() :: (String.t() -> parser_result())
@type error() :: String.t()
@type flag_spec_item() :: {name :: atom(), [flag_spec_param()]}
@type flag_spec_param() ::
  {:short, String.t()}
  | {:long, String.t()}
  | {:help, String.t()}
  | {:multiple, boolean()}
@type option_spec_item() :: {name :: atom(), [option_spec_param()]}
@type option_spec_param() ::
  {:value_name, String.t()}
  | {:short, String.t()}
  | {:long, String.t()}
  | {:help, String.t()}
  | {:multiple, boolean()}
  | {:required, boolean()}
  | {:parser, parser()}
  | {:default, any()}
@type parser() :: :integer | :float | :string | custom_parser()
@type parser_result() :: {:error, String.t()} | {:ok, term()}
@type spec() :: [spec_item()]
@type spec_item() ::
  {:name, String.t()}
  | {:description, String.t()}
  | {:version, String.t()}
  | {:author, String.t()}
  | {:about, String.t()}
  | {:allow_unknown_args, boolean()}
  | {:parse_double_dash, boolean()}
  | {:args, [arg_spec_item()]}
  | {:flags, [flag_spec_item()]}
  | {:options, [option_spec_item()]}
  | {:subcommands, [{atom(), spec()}]}
@type subcommand_path() :: [atom()]
@opaque t()

Link to this section Functions

Link to this function

fetch_subcommand(optimus, subcommand_path)

View Source
Link to this function

fetch_subcommand(optimus, list, subcommand_name)

View Source
@spec new(spec()) :: {:ok, t()} | {:error, [error()]}
@spec new!(spec()) :: t() | no_return()
Link to this function

parse(optimus, command_line)

View Source
@spec parse(t(), [String.t()]) ::
  {:ok, Optimus.ParseResult.t()}
  | {:ok, subcommand_path(), Optimus.ParseResult.t()}
  | {:error, [error()]}
  | {:error, subcommand_path(), [error()]}
  | :version
  | :help
  | {:help, subcommand_path()}
Link to this function

parse!(optimus, command_line, halt \\ &System.halt/1)

View Source