Listen to git commits for a specific repo and run a shell command
1# `tangled-on-commit`
2
3Run a shell command whenever a specific repo gets a commit
4
5```sh
6$ tangled-on-commit @vielle.dev/tangled-on-commit ./commit.sh
7```
8
9> Created for linux. Should work fine on MacOS. Will not work on windows.
10> Note: The shell command is placed inside `/bin/sh -c "COMMAND"`, so make sure to escape quotes and backslashes. I reccomend executing a shell file and piping stdout and stderr to a log file
11
12## Installation
13
14Prerequisites:
15
16- `Git`
17- `Rust` (1.88+)
18- `Cargo`
19- `OpenSSL` (required for ssl connection)
20- `pkg-config` (required for ssl connection)
21
221. Clone this repo:
23 `git clone git@tangled.sh:vielle.dev/tangled-on-commit`
242. Compile the binary:
25 `cargo build --release`
263. Copy the binary to your path:
27 `sudo cp ./target/release/tangled-on-commit /bin`
28
29## Usage
30
31### CLI Arguments
32
33- `tangled-on-commit (-h | --help)`
34 Displays this message
35
36- `tangled-on-commit`
37 No specified handle, repo, or command. Falls back to config/env
38
39- `tangled-on-commit SHELL`
40 Uses config/env for handle and repo
41
42- `tangled-on-commit @HANDLE SHELL`
43 Uses config/env for repo
44
45- `tangled-on-commit REPO SHELL`
46 Uses config/env for handle
47
48- `tangled-on-commit @HANDLE/REPO SHELL`
49 `tangled-on-commit HANDLE REPO SHELL`
50 No config/env
51
52### JSON
53
54Loads the file `tangled-on-commit.json` from cwd if it exists.
55Reads keys \"handle\", \"repo_name\", and \"shell\".
56Unknown keys are ignored and any key can be ommitted
57JSON is used if the arguments aren't passed to the CLI
58
59### Env
60
61Loads the environment variables `TANGLED_ON_COMMIT_HANDLE` and `TANGLED_ON_COMMIT_REPO_NAME`
62Shell cannot be set by environment variables.
63Env variables are used if relevant keys are ommitted an arguments aren't passed to the CLI.