# `Cheer.Router`
[🔗](https://github.com/joshrotenberg/cheer/blob/v0.2.2/lib/cheer/router.ex#L1)

Routes argv through the command tree and dispatches to the matched command.

Handles the full dispatch pipeline: subcommand matching, option parsing
(via `OptionParser`), default/env-var application, validation (required
fields, choices, custom validators, cross-param validators, groups), and
lifecycle hook execution.

This module is called internally by `Cheer.run/3` and is not typically
invoked directly.

# `dispatch`

```elixir
@spec dispatch(module(), [String.t()], keyword()) :: term()
```

Dispatch `argv` through the command tree rooted at `command`.

Options:

  * `:prog` - program name for help/usage output
  * `:mode` - `:run` (default) invokes the matched command's `run/2`;
    `:parse` stops after validation and returns `{:ok, command, args}`
  * `:parent_hooks` - (internal) accumulated persistent hooks from parent commands

---

*Consult [api-reference.md](api-reference.md) for complete listing*
