Allow passing in author to add-exercise script (#146)
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if (( $# != 1 )); then
|
||||
if (( $# < 1 )); then
|
||||
echo >&2 "Populates a new directory for a practice exercise."
|
||||
echo >&2 "Usage: $0 <exercise-slug>"
|
||||
echo >&2 "Usage: $0 <exercise-slug> [author]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -39,8 +39,13 @@ end-of-tests
|
||||
;with
|
||||
END_TEST
|
||||
|
||||
echo
|
||||
read -rp 'Your github username: ' author
|
||||
if (( $# < 2 )); then
|
||||
echo
|
||||
read -rp 'Your github username: ' author
|
||||
else
|
||||
author="${2}"
|
||||
fi
|
||||
|
||||
conf="exercises/practice/${slug}/.meta/config.json"
|
||||
jq --arg author "${author}" \
|
||||
'.authors = [$author]' "${conf}" > "${conf}.tmp" \
|
||||
|
||||
Reference in New Issue
Block a user