Recode.Config (Recode v0.8.0)

View Source

Functions to read and merge the Recode configuration.

Summary

Functions

Returns the default configuration.

Returns the default config filename.

Deletes the given tasks from the config.

Merges two configs into one.

Reads the Recode cofiguration from the given path.

Returns the given config as a formatted string with comments.

Validates the config version and tasks.

Types

config()

@type config() :: keyword()

Functions

default()

@spec default() :: config()

Returns the default configuration.

default_filename()

Returns the default config filename.

delete_tasks(config, tasks)

@spec delete_tasks(config(), [module()]) :: config()

Deletes the given tasks from the config.

merge(left \\ default(), right)

@spec merge(config(), config()) :: config()

Merges two configs into one.

The merge will do a deep merge. The merge takes the version from the right config.

Examples

iex> new = [version: "0.0.2", verbose: false, autocorrect: true]
...> old = [version: "0.0.1", verbose: true]
iex> Recode.Config.merge(new ,old) |> Enum.sort()
[autocorrect: true, verbose: true, version: "0.0.2"]

read(path \\ ".recode.exs")

@spec read(Path.t()) :: {:ok, config()} | {:error, :not_found}

Reads the Recode cofiguration from the given path.

to_string(config \\ default())

@spec to_string(config()) :: String.t()

Returns the given config as a formatted string with comments.

validate(config)

@spec validate(config()) :: :ok | {:error, :out_of_date | :no_tasks}

Validates the config version and tasks.