GitHooks.Tasks.File.new
You're seeing just the function
new
, go back to GitHooks.Tasks.File module for more information.
Link to this function
new(arg, git_hook_type, git_hook_args)
Specs
new( {:file, path :: String.t(), [any()]}, GitHooks.git_hook_type(), GitHooks.git_hook_args() ) :: t()
Creates a new file
struct.
This function expects a tuple or triple with :file
, the file path and
the opts.
Options
include_hook_args
: Whether the git options will be passed as argument when executing the file. You will need to check which arguments are being sent by each git hook.env
: The environment variables that will be set in the execution context of the file.
Example
iex> Elixir.GitHooks.Tasks.File.new({:file, :test, env: [{"var", "test"}], include_hook_args: true}, :pre_commit, ["commit message"])
%Elixir.GitHooks.Tasks.File{file_path: :test, args: ["commit message"], env: [{"var", "test"}], git_hook_type: :pre_commit}
iex> Elixir.GitHooks.Tasks.File.new({:file, :test, include_hook_args: false}, :pre_commit, ["commit message"])
%Elixir.GitHooks.Tasks.File{file_path: :test, args: [], env: [], git_hook_type: :pre_commit}