Credo.CLI.Options (Credo v1.5.0) View Source

The Options struct represents the options given on the command line.

The Options struct is stored as part of the Execution struct.

Link to this section Summary

Link to this section Functions

Link to this function

parse(argv, current_dir, command_names, ignored_args, switches_definition, aliases)

View Source

Returns a Options struct for the given parameters.

iex> Credo.CLI.Options.parse(["alice", "--debug"], ".", ["alice", "bob", "eve"], [], [debug: :boolean], [])
%Credo.CLI.Options{args: [], command: "alice", path: ".", switches: %{debug: true}, unknown_args: [], unknown_switches: []}

iex> Credo.CLI.Options.parse(["alice", "--friend", "bob", "--friend", "eve"], ".", ["alice", "bob", "eve"], [], [friend: :keep], [])
%Credo.CLI.Options{args: [], command: "alice", path: ".", switches: %{friend: ["bob", "eve"]}, unknown_args: [], unknown_switches: []}

iex> Credo.CLI.Options.parse(["alice", "--friend", "bob", "--friend", "eve"], ".", ["alice", "bob", "eve"], [], [friend: [:string, :keep]], [])
%Credo.CLI.Options{args: [], command: "alice", path: ".", switches: %{friend: ["bob", "eve"]}, unknown_args: [], unknown_switches: []}