From dce19267f516ca08dd6ee313952335f95169eacd Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 21 Nov 2018 00:00:59 +0530 Subject: [PATCH 1/5] add command hook --- .gitignore | 2 ++ .pre-commit-hooks.yaml | 6 +++++- run-command.sh | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100755 run-command.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c3da290 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/* + diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index d92c9b4..88bf7f8 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -60,4 +60,8 @@ entry: run-go-build.sh files: '\.go$' language: 'script' - description: "Runs `go build`, requires golang" + description: "Runs `go build`, requires golang" +- id: exec-command + name: 'exec-command' + entry: run-command.sh + language: 'script' diff --git a/run-command.sh b/run-command.sh new file mode 100755 index 0000000..2240bb3 --- /dev/null +++ b/run-command.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec $1 From 9c5decd8d52c0563986f9442e9f76a75a0890156 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 21 Nov 2018 00:10:48 +0530 Subject: [PATCH 2/5] Added description for exec-command --- .pre-commit-hooks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 88bf7f8..ba2b0a3 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -65,3 +65,4 @@ name: 'exec-command' entry: run-command.sh language: 'script' + description: "It can run any command pass in args." From 02e99024f223d3041cd71f55f7bd8620b25a37d5 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 21 Nov 2018 00:12:57 +0530 Subject: [PATCH 3/5] Excluded gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c3da290..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.idea/* - From 5f8db39f1098e3e92c6eff8d310ce166f75d011b Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 28 Nov 2018 23:55:45 +0530 Subject: [PATCH 4/5] Update run-command.sh Update to run make command --- run-command.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-command.sh b/run-command.sh index 2240bb3..e4ffa23 100755 --- a/run-command.sh +++ b/run-command.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec $1 +make $1 From ef9c5b75137705dcd1f32eedf5dc81caec4db70b Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 28 Nov 2018 23:56:19 +0530 Subject: [PATCH 5/5] Set -e option --- run-command.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/run-command.sh b/run-command.sh index e4ffa23..56aa968 100755 --- a/run-command.sh +++ b/run-command.sh @@ -1,2 +1,3 @@ #!/usr/bin/env bash +set -e make $1