GitHooks.Tasks.Mix (git_hooks v0.6.4) View Source

Represents a Mix task that will be executed as a git hook task.

A mix task should be configured as {:mix_task, task_name, task_args}, being task_args an optional configuration. See Elixir.GitHooks.Tasks.Mix.new/1 for more information.

For example:

config :git_hooks,
  hooks: [
    pre_commit: [
      {:mix_task, :test},
      {:mix_task, :format, ["--dry-run"]}
    ]
  ]

See https://hexdocs.pm/mix/Mix.Task.html#run/2 for reference.

Link to this section Summary

Types

t()

Represents a Mix task.

Functions

Creates a new Mix task struct.

Link to this section Types

Specs

t() :: %GitHooks.Tasks.Mix{
  args: [any()],
  result: term(),
  task: Mix.Task.task_name()
}

Represents a Mix task.

Link to this section Functions

Specs

new({:mix_task, Mix.Task.task_name(), [any()]} | Mix.Task.task_name()) :: t()

Creates a new Mix task struct.

This function expects a tuple or triple with :mix_task, the task name and the task args.

Examples

iex> Elixir.GitHooks.Tasks.Mix.new({:mix_task, :test, ["--failed"]})
%Elixir.GitHooks.Tasks.Mix{task: :test, args: ["--failed"]}