Skip to content

Commit

Permalink
Set interactive or debug mode only if variables are set to true
Browse files Browse the repository at this point in the history
  • Loading branch information
tinamthomas committed Sep 7, 2020
1 parent 648e456 commit 89bc7ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions global_install_scripts/talisman_hook_script.bash
Expand Up @@ -26,6 +26,10 @@ function echo_success() {
echo -ne $(tput sgr0)
}

function toLower(){
echo "$1" | awk '{print tolower($0)}'
}

declare HOOKNAME="pre-commit"
NAME=$(basename $0)
ORG_REPO=${ORG_REPO:-'thoughtworks/talisman'}
Expand Down Expand Up @@ -73,9 +77,9 @@ if [[ -f .talisman_skip || -f .talisman_skip.${HOOKNAME} ]]; then
fi

DEBUG_OPTS=""
[[ -n "${TALISMAN_DEBUG}" ]] && DEBUG_OPTS="-d"
[[ $(toLower "${TALISMAN_DEBUG}") == "true" ]] && DEBUG_OPTS="-d"
INTERACTIVE=""
[[ -n "${TALISMAN_INTERACTIVE}" ]] && INTERACTIVE="-i"
[[ $(toLower "${TALISMAN_INTERACTIVE}") == "true" ]] && INTERACTIVE="-i"

CMD="${TALISMAN_BINARY} ${DEBUG_OPTS} --githook ${HOOKNAME} ${INTERACTIVE}"
echo_debug "ARGS are $@"
Expand Down

0 comments on commit 89bc7ba

Please sign in to comment.