# `MobDev.TaskHelp`
[🔗](https://github.com/genericjam/mob_dev/blob/master/lib/mob_dev/task_help.ex#L1)

Helpers for `--help` / `-h` handling in mob_dev Mix tasks.

Mix has `mix help <task>` built in (reads the task module's
`@moduledoc`), but users from outside the Elixir ecosystem expect
`<command> --help` to work too. This module gives each task a
one-line opt-in:

    def run(args) do
      if MobDev.TaskHelp.help_requested?(args) do
        MobDev.TaskHelp.print_module_help(__MODULE__)
      else
        # normal flow…
      end
    end

Public API is intentionally tiny — two predicates and a printer —
so a future change to where `@moduledoc` is stored (or how it gets
rendered) only ripples through one file.

# `help_requested?`

```elixir
@spec help_requested?([String.t()]) :: boolean()
```

True when `argv` contains `--help` or `-h` as a standalone arg.

    iex> MobDev.TaskHelp.help_requested?(["--help"])
    true

    iex> MobDev.TaskHelp.help_requested?(["-h"])
    true

    iex> MobDev.TaskHelp.help_requested?(["--device", "foo"])
    false

    iex> MobDev.TaskHelp.help_requested?([])
    false

# `print_module_help`

```elixir
@spec print_module_help(module()) :: :ok
```

Prints `task_module`'s `@moduledoc` to stdout.

Falls back to a small "no docs available" message if the module
has no `@moduledoc` (which shouldn't happen for any mob_dev task
but the fallback keeps `print_module_help/1` total).

---

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