Commit 1ce43bbf authored by multrus's avatar multrus
Browse files

avoid BASH 5 syntax, which is not supported on MacOS

parent 01784bc1
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -55,10 +55,10 @@ REPO_STRING=""
while getopts "r:s:h" OPTIONS; do
    case ${OPTIONS} in
    r)
        REPO_STRING=${OPTARG}
        REPO_STRING=`echo ${OPTARG} | tr '[:upper:]' '[:lower:]'`    # => transorm to lower case
        ;;
    s) 
        STATUS_STRING=${OPTARG}
        STATUS_STRING=`echo ${OPTARG} | tr '[:upper:]' '[:lower:]'`  # => transorm to lower case
        ;;
    h | *)
        usage
@@ -70,9 +70,9 @@ shift $((OPTIND - 1))
# check, whether we should use float or BASOP
PROJECT_ID=$PROJECT_ID_FLOAT
if [ -n "$REPO_STRING" ]; then
  if [ "${REPO_STRING,,}" = "basop" ]; then     # ,, => transorm to lower case
  if [ "$REPO_STRING" = "basop" ]; then
      PROJECT_ID=$PROJECT_ID_BASOP
  elif [ "${REPO_STRING,,}" = "float" ]; then   # ,, => transorm to lower case
  elif [ "$REPO_STRING" = "float" ]; then
      PROJECT_ID=$PROJECT_ID_FLOAT
  else 
      echo "Invalid repository string given; defaulting to float (ivas-codec)"
@@ -82,11 +82,11 @@ fi
# check, which MR status we should list
CURL_STR="$GITLAB_URL/projects/$PROJECT_ID/merge_requests?state=opened&wip=no&target_branch=main&per_page=$PER_PAGE"
if [ -n "$STATUS_STRING" ]; then
    if [ "${STATUS_STRING,,}" = "ready" ]; then     # ,, => transorm to lower case
    if [ "$STATUS_STRING" = "ready" ]; then
        CURL_STR="$GITLAB_URL/projects/$PROJECT_ID/merge_requests?state=opened&wip=no&target_branch=main&per_page=$PER_PAGE"
    elif [ "${STATUS_STRING,,}" = "draft" ]; then   # ,, => transorm to lower case
    elif [ "$STATUS_STRING" = "draft" ]; then
        CURL_STR="$GITLAB_URL/projects/$PROJECT_ID/merge_requests?state=opened&wip=yes&target_branch=main&per_page=$PER_PAGE"
    elif [ "${STATUS_STRING,,}" = "all" ]; then     # ,, => transorm to lower case
    elif [ "$STATUS_STRING" = "all" ]; then
        CURL_STR="$GITLAB_URL/projects/$PROJECT_ID/merge_requests?state=opened&target_branch=main&per_page=$PER_PAGE"
    else
        echo "Invalid MR status string given; defaulting to ready"
@@ -103,7 +103,6 @@ while :; do

    # check length of response
    LENGTH=$(echo "$RESPONSE" | jq '. | length')
    echo $LENGTH

    # break if no results are returned
    if [ "$LENGTH" -eq 0 ]; then
@@ -118,4 +117,3 @@ while :; do
done

echo "$RESULTS" | jq -r '.[] | "\(.web_url) - \(.title)"'