View Source Tux.Locator (Tux v0.4.0)

Find the command module for a given command name.

Summary

Types

Command definition as registered with its dispatcher

Command name given to the CLI

Returned error messages

Functions

Locate the corresponding command module associated with a given command name which was typed at the command line.

Types

@type cmd_def() :: {cmd_regname(), cmd_module(), cmd_opts()}

Command definition as registered with its dispatcher

@type cmd_module() :: Tux.Command.t()
@type cmd_name() :: String.t()

Command name given to the CLI

@type cmd_opts() :: keyword()
@type cmd_regname() :: {:exact | :prefix, String.t()}
@type locate_err_msg() :: :cmd_conflict | :cmd_undefined

Returned error messages

Functions

Link to this function

locate_cmd_module(cmd_defs, cmd_name)

View Source
@spec locate_cmd_module([cmd_def()], cmd_name()) ::
  {:ok, cmd_def()} | {:error, locate_err_msg()}

Locate the corresponding command module associated with a given command name which was typed at the command line.