From 87144873dd27b208d5ad5e4997ec0c4c70383e95 Mon Sep 17 00:00:00 2001 From: Bastien Gatellier Date: Wed, 25 Oct 2023 21:41:39 +0200 Subject: [PATCH] fix: command line generation --- entrypoint.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 03f2cae..b95ff8f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,13 +2,13 @@ # generate_heart_command analysisService config threshold except-listeners only-listeners verbose # Generate the heart command from the given arguments. -generate_heart_command() { - local cliOptions=" --config $2" +function generate_heart_command { + local cliOptions=" --config $1" - if [ -n "$3" ]; then cliOptions+=" --threshold $3"; fi - if [ -n "$4" ]; then cliOptions+=" --except-listeners $4"; fi - if [ -n "$5" ]; then cliOptions+=" --only-listeners $5"; fi - if [ -n "$6" ]; then cliOptions+=" --verbose"; fi + if [ -n "$2" ]; then cliOptions+=" --threshold $2"; fi + if [ -n "$3" ]; then cliOptions+=" --except-listeners $3"; fi + if [ -n "$4" ]; then cliOptions+=" --only-listeners $4"; fi + if [ -n "$5" ]; then cliOptions+=" --verbose"; fi echo $1$cliOptions } @@ -16,7 +16,7 @@ generate_heart_command() { # trim(string) # Trim a string. # see https://stackoverflow.com/a/3232433 -trim() { +function trim { echo "$(echo -e "${1}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" } @@ -31,6 +31,7 @@ exceptServices=$(trim $4) onlyServices=$(trim $5) verbose=$(trim $6) +echo "$GITHUB_WORKSPACE/$config" if [[ -f "$GITHUB_WORKSPACE/$config" ]]; then config="$GITHUB_WORKSPACE/$config" fi