mix mod.new (modkit v0.9.1)

Copy Markdown View Source

Creates a new module in the current application, based on a template.

The location of the new module is defined according to the :mount option in :modkit configuration defined in the project file (mix.exs).

If not defined, default mount points are defined as follows:

[
  {App, "lib/app"}
  {Mix.Tasks, "lib/mix/tasks", flavor: :mix_task}
]

Synopsis

mix mod.new [options] module

Arguments

  • module

Options

  • -t, --template <string> - Use the given template for the module code.

    Accepts a path to an .eex file or a built-in template:

    Base, DynamicSupervisor, GenServer, Mix.Task, Supervisor.

  • -u, --test - Create a unit test module for the generated module. Defaults to false.

  • -U, --test-only - Create the unit test only, without generating the module. Defaults to false.

  • -p, --path <string> - The path of the module file to write (must end with .ex). Only applies to the module file; when --test/--test-only is given, the test file path is derived from it. Unnecessary if the module prefix is mounted.

  • -o, --overwrite - Overwrite existing files. Defaults to false.

  • --help - Displays this help.

Summary

Functions

generate(project, module, options)