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

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

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

Represents a Mix task.

Link to this section Functions

@spec 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

Examples

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