File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ One or more git hooks can be configured, those hooks will be the ones
67
67
68
68
Currently there are supported two configuration options:
69
69
70
- * ** tasks** : A list of the commands that will be executed when running a git hook
70
+ * ** tasks** : A list of the commands that will be executed when running a git hook. [ See types of tasks ] ( #type-of-tasks ) for more info.
71
71
* ** verbose** : If true, the output of the mix tasks will be visible. This can be configured globally or per git hook.
72
72
73
73
``` elixir
@@ -90,17 +90,40 @@ config :git_hooks,
90
90
]
91
91
```
92
92
93
- ### Using a script file
93
+ ### Type of tasks
94
94
95
- It's possible configure a script file to run as a git hook:
95
+ #### Command
96
+
97
+ To run a simple command you can either declare a string or a tuple with the
98
+ command you want to run. If you want to forward the git hook arguments, add the
99
+ option ` include_hook_args?: true ` .
100
+
101
+ ``` elixir
102
+ config :git_hooks ,
103
+ verbose: true ,
104
+ hooks: [
105
+ commit_msg: [
106
+ tasks: [
107
+ {:cmd , " echo 'test'" },
108
+ {:cmd , " elixir ./priv/test_task.ex" , include_hook_args?: true },
109
+ ]
110
+ ]
111
+ ]
112
+ ```
113
+ #### Executable file
114
+
115
+ The following configuration uses a script file to be run with a git hook. If you
116
+ want to forward the git hook arguments, add the option `include_hook_args?:
117
+ true`.
96
118
97
119
``` elixir
98
120
config :git_hooks ,
99
121
verbose: true ,
100
122
hooks: [
101
123
commit_msg: [
102
124
tasks: [
103
- {:file , " ./priv/test_script" }
125
+ {:file , " ./priv/test_script" },
126
+ {:file , " ./priv/test_script_with_args" , include_hook_args?: true },
104
127
]
105
128
]
106
129
]
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ defmodule GitHooks.MixProject do
3
3
4
4
use Mix.Project
5
5
6
- @ version "0.3.1-pre "
6
+ @ version "0.3.2-pre3 "
7
7
8
8
def project do
9
9
[
You can’t perform that action at this time.
0 commit comments