Skip to content

Commit 2078f1b

Browse files
committed
Update README
1 parent c22bacb commit 2078f1b

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ One or more git hooks can be configured, those hooks will be the ones
6767

6868
Currently there are supported two configuration options:
6969

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.
7171
* **verbose**: If true, the output of the mix tasks will be visible. This can be configured globally or per git hook.
7272

7373
```elixir
@@ -90,17 +90,40 @@ config :git_hooks,
9090
]
9191
```
9292

93-
### Using a script file
93+
### Type of tasks
9494

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`.
96118

97119
```elixir
98120
config :git_hooks,
99121
verbose: true,
100122
hooks: [
101123
commit_msg: [
102124
tasks: [
103-
{:file, "./priv/test_script"}
125+
{:file, "./priv/test_script"},
126+
{:file, "./priv/test_script_with_args", include_hook_args?: true},
104127
]
105128
]
106129
]

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule GitHooks.MixProject do
33

44
use Mix.Project
55

6-
@version "0.3.1-pre"
6+
@version "0.3.2-pre3"
77

88
def project do
99
[

0 commit comments

Comments
 (0)