Listen to git commits for a specific repo and run a shell command

Better help logs

vielle.dev 9492ba66 f2c2aa96

verified
Changed files
+39 -2
src
+39 -2
src/main.rs
··· 1 1 fn help() { 2 - println!("\n\nHELP: tangled-on-commit\n\n") 2 + println!("Help: tangled-on-commit 3 + Listen for commits on a specified repository and execute a shell command. 4 + 5 + CLI Arguments: 6 + `tangled-on-commit (-h | --help)` 7 + Displays this message 8 + 9 + `tangled-on-commit` 10 + No specified handle, repo, or command. Falls back to config/env 11 + 12 + `tangled-on-commit SHELL` 13 + Uses config/env for handle and repo 14 + 15 + `tangled-on-commit @HANDLE SHELL` 16 + Uses config/env for repo 17 + 18 + `tangled-on-commit REPO SHELL` 19 + Uses config/env for handle 20 + 21 + `tangled-on-commit @HANDLE/REPO SHELL` 22 + `tangled-on-commit HANDLE REPO SHELL` 23 + No config/env 24 + 25 + JSON: 26 + Loads the file `tangled-on-commit.json` from cwd if it exists. 27 + Reads keys \"handle\", \"repo_name\", and \"shell\". 28 + Unknown keys are ignored and any key can be ommitted 29 + JSON is used if the arguments aren't passed to the CLI 30 + 31 + Env: 32 + Loads the environment variables `TANGLED_ON_COMMIT_HANDLE` and `TANGLED_ON_COMMIT_REPO_NAME` 33 + Shell cannot be set by environment variables. 34 + Env variables are used if relevant keys are ommitted an arguments aren't passed to the CLI. 35 + ") 3 36 } 4 37 5 38 #[derive(Debug)] ··· 164 197 165 198 // couldnt resolve every value 166 199 // print an error and quit 167 - println!("@{handle:?}/{repo_name:?}: {shell:?}"); 200 + println!("Unable to find a value for every setting. Missing values for:"); 201 + if handle.is_none() {println!("- handle");} 202 + if repo_name.is_none() {println!("- repo_name");} 203 + if shell.is_none() {println!("- shell");} 204 + println!("\nRun `tangled-on-commit --help` to see the help message"); 168 205 return Err(()); 169 206 } 170 207