View Source Igniter.Project.TaskAliases (igniter v0.5.2)

Codemods and utilities for interacting with task aliases in the mix.exs file

Summary

Functions

Adds an alias to the mix.exs file

Modifies an existing alias, doing nothing if it doesn't exist

Functions

add_alias(igniter, name, value, opts \\ [])

@spec add_alias(
  Igniter.t(),
  atom() | String.t(),
  String.t() | {:code, term()} | [String.t() | {:code, term()}],
  opts :: Keyword.t()
) :: Igniter.t()

Adds an alias to the mix.exs file

Options

  • :if_exists - How to alter the alias if it already exists. Options are:
  • :ignore - Do nothing if the alias already exists. This is the default.
  • :prepend - Add the new alias to the beginning of the list (if it is not already present).
  • {:prepend, value} - Add a different value than the originally supplied alias to the beginning of the list (if it is not already present).
  • {:replace_or_append, old, new} - If the old value is in the list, it is replaced with the new value. Otherwise the new value is appended (if it is not already present).
  • :append - Add the new alias to the end of the list (if it is not already present).
  • {:append, value} - Add a different value than the originally supplied alias to the end of the list (if it is not already present).
  • :warn - Print a warning if the alias already exists.

modify_existing_alias(igniter, name, updater)

@spec modify_existing_alias(
  Igniter.t(),
  atom() | String.t(),
  (Sourceror.Zipper.t() -> {:ok, Sourceror.Zipper.t()} | :error)
) :: Igniter.t()

Modifies an existing alias, doing nothing if it doesn't exist