View Source mix git_hooks.run (git_hooks v0.7.3)

Runs all the configured mix tasks for a given git hook.

Any git hook is supported.

examples

Examples

You can run any hook by running mix git_hooks.run hook_name. For example:

mix git_hooks.run pre_commit

You can also all the hooks which are configured with mix git_hooks.run all.

Link to this section Summary

Types

Run options

Functions

Runs a task for a given git hook.

Link to this section Types

@type run_opts() :: [include_hook_args: String.t(), env: [{String.t(), binary()}]]

Run options:

  • include_hook_args: Whether the git hook args should be sent to the command to be executed. In case of true, the args will be amended to the command. Defaults to false.

Link to this section Functions

@spec run([String.t()]) :: :ok | no_return()

Runs a task for a given git hook.

The task can be one of three different types:

  • {:cmd, "command arg1 arg2"}: Runs a command.
  • {:file, "path_to_file"}: Runs an executable file.
  • "command arg1 arg2": Runs a simple command, supports no options.

The first two options above can use a third element in the tuple, see here more info about the options.