-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c01bfc
commit e3fa686
Showing
2 changed files
with
62 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
die() { echo "$*" >&2; exit 1; } | ||
|
||
if [[ $PWD != $(realpath "$(dirname "$0")/..") ]]; then | ||
die "You must be in the track root directory." | ||
fi | ||
if [[ -z $1 ]]; then | ||
die "usage: $0 exercise_slug" | ||
fi | ||
|
||
slug=$1 | ||
|
||
existing=$( jq --arg slug "${slug}" '.exercises.practice[] | select(.slug == $slug)' config.json ) | ||
if [[ -n ${existing} ]]; then | ||
die "${slug} already exists in config.json" | ||
fi | ||
|
||
if [[ -z $author ]]; then | ||
echo | ||
read -rp "What's your github username? " author | ||
fi | ||
|
||
read -p "What's the difficulty for ${slug}? " difficulty | ||
|
||
bin/fetch-configlet | ||
bin/configlet create --practice-exercise "${slug}" --author "${author}" --difficulty "${difficulty}" | ||
|
||
cp exercises/practice/hello-world/.docs/hints.md exercises/practice/${slug}/.docs/hints.md | ||
|
||
touch exercises/practice/${slug}/.docs/instructions.append.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters