Skip to content

Commit

Permalink
Merge pull request #1 from EchoesHQ/fix/mapfile
Browse files Browse the repository at this point in the history
feat: support for comma separated list of commits & deliverables
  • Loading branch information
AdrienFromToulouse authored Oct 28, 2024
2 parents 2304593 + 36f96d2 commit da30208
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,32 @@ while getopts ":t:v:d:c:s:i:" opt; do
v) version=$(trim "${OPTARG}")
;;
d)
mapfile -t deliverables < <(trim "${OPTARG}")
deliverables=()

if [[ "${OPTARG}" =~ ^([^,]+,)+[^,]+$ ]]; then # Support comma separated list of deliverables
IFS=',' read -r -a raw_deliverables <<< "${OPTARG}"
else
mapfile -t raw_deliverables < <(echo "${OPTARG}") # Support Newline-separated list of deliverables
fi

for deliverable in "${raw_deliverables[@]}"; do
trimmed_deliverable=$(trim "$deliverable")
deliverables+=("$trimmed_deliverable")
done
;;
c)
mapfile -t commits < <(trim "${OPTARG}")
commits=()

if [[ "${OPTARG}" =~ ^([^,]+,)+[^,]+$ ]]; then # Support comma separated list of commits
IFS=',' read -r -a raw_commits <<< "${OPTARG}"
else
mapfile -t raw_commits < <(echo "${OPTARG}") # Support Newline-separated list of commits
fi

for commit in "${raw_commits[@]}"; do
trimmed_commit=$(trim "$commit")
commits+=("$trimmed_commit")
done
;;
s) status=$(trim "${OPTARG}")
;;
Expand Down

0 comments on commit da30208

Please sign in to comment.