Cascade (Cascade v0.3.0)

View Source

Generate code from templates.

Summary

Functions

Generate the code associated to the given template name.

Returns all available templates.

Functions

generate(name, root_path, args_or_opts \\ [], opts \\ [])

@spec generate(
  name :: atom(),
  root_path :: String.t(),
  args_or_opts :: keyword() | [String.t()],
  opts :: keyword()
) :: {:error, String.t()} | :ok

Generate the code associated to the given template name.

  • root_path is expected to be the root directory under which the template will be generated.
  • args_or_opts can be an arbitrary keyword list with the template options or a list of command line arguments passed to the mix cascade task. In the latter case the arguments will be validated using the template's Cascade.Template.args_schema/0.

Options

  • :force - if set existing files are overwritten without asking, defaults to false.

templates()

@spec templates() :: keyword()

Returns all available templates.

All modules implementing the Cascade.Template behaviour will be returned.