View Source Igniter.Mix.Task behaviour (igniter v0.3.2)

A behaviour for implementing a Mix task that is enriched to be composable with other Igniter tasks.

Summary

Callbacks

All the generator behavior happens here, you take an igniter and task arguments, and return an igniter.

Returns an Igniter.Mix.Task.Info struct, with information used when running the igniter task.

Whether or not it supports being run in the root of an umbrella project

Callbacks

@callback igniter(igniter :: Igniter.t(), argv :: [String.t()]) :: Igniter.t()

All the generator behavior happens here, you take an igniter and task arguments, and return an igniter.

@callback info(argv :: [String.t()], source :: nil | String.t()) ::
  Igniter.Mix.Task.Info.t()

Returns an Igniter.Mix.Task.Info struct, with information used when running the igniter task.

This info will be used to validate arguments in composed tasks.

Important Limitations

  • Each task still must parse its own argv in igniter/2 and must ignore any unknown options. To accomplish this, use the automatically imported options!(argv) macro, which uses the info/2 callback to validate args and return options
  • You cannot use composes to list tasks unless they are in your library or in direct dependencies of your library. To validate their options, you must include their options in your own option schema.
@callback supports_umbrella?() :: boolean()

Whether or not it supports being run in the root of an umbrella project

At the moment, this is still experimental and we suggest not turning it on.

Functions

Link to this macro

options!(argv)

View Source (macro)
@spec options!(argv :: term()) :: term() | no_return()