Skip to content

Commit

Permalink
Use author env variable if set
Browse files Browse the repository at this point in the history
  • Loading branch information
keiravillekode committed Oct 27, 2024
1 parent 485789a commit f0de62b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions bin/create-exercise
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ while [[ ${pascal} =~ (.*)-(.*) ]]; do
pascal=${BASH_REMATCH[1]}${BASH_REMATCH[2]^}
done

if [[ -z $author ]]; then
echo
read -rp "What's your GitHub handle? " author
fi

bin/fetch-configlet
bin/configlet create --practice-exercise "${slug}"
bin/configlet create --practice-exercise "${slug}" --author "${author}"

shDir=./exercises/shared/new-exercise-templates
exDir=./exercises/practice/${slug}
Expand Down Expand Up @@ -118,14 +123,6 @@ __PROOF_WREN__

############################################################

read -p "What's your GitHub handle? "
if [[ -n ${REPLY} ]]; then
conf=${exDir}/.meta/config.json
tmp=$(mktemp)
jq --arg who "${REPLY}" '.authors += [$who]' "${conf}" > "${tmp}" \
&& mv "${tmp}" "${conf}"
fi

read -p "What's the (likely) difficult for ${slug}? "
if [[ -n ${REPLY} && ${REPLY} == +([0-9]) ]]; then
tmp=$(mktemp)
Expand Down

0 comments on commit f0de62b

Please sign in to comment.