Packages

An `Elixir` library to write command line apps in a cleaner and elegant way!

Current section

Files

Jump to
nexus_cli lib nexus command_dispatcher.ex
Raw

lib/nexus/command_dispatcher.ex

defmodule Nexus.CommandDispatcher do
@moduledoc false
alias Nexus.Command
@spec dispatch!(Nexus.command(), list(binary)) :: :ok
def dispatch!({cmd, %Command{} = spec}, raw) do
{:ok, cli} = Nexus.CLI.parse_command({cmd, spec}, raw)
spec.module.handle_input(cmd, cli)
:ok
end
end