pass hook configuration through CLI arguments
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Default standalone policy: append the hook invocation and its stdin to a log.
|
||||
# Integrations can supply another script with simplegit daemon -hook-script.
|
||||
# Default standalone policy. Optional CLI: --log=/path/to/hooks.log --
|
||||
|
||||
log_file=${SIMPLEGIT_HOOK_LOG:-${SIMPLEGIT_REPO_ROOT%/repos}/hooks.log}
|
||||
log_file=
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--log=*) log_file=${1#--log=}; shift ;;
|
||||
--log) log_file=$2; shift 2 ;;
|
||||
--) shift; break ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
[ "$#" -ge 2 ] || exit 0
|
||||
if [ -z "$log_file" ]; then
|
||||
repo_dir=$(pwd -P)
|
||||
log_file=${repo_dir%/*/*}/hooks.log
|
||||
fi
|
||||
{
|
||||
printf '%s\t%s\t%s' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$1" "$2"
|
||||
shift 2
|
||||
|
||||
Reference in New Issue
Block a user