mirror of
https://github.com/Crocmagnon/advent-of-code.git
synced 2024-11-23 06:58:06 +01:00
25 lines
683 B
Bash
Executable file
25 lines
683 B
Bash
Executable file
#!/bin/bash
|
|
set -euxo pipefail
|
|
|
|
if [[ $# -ne 2 ]]; then
|
|
>&2 echo "Usage: $0 <number> <name>"
|
|
exit 2
|
|
fi
|
|
|
|
filename=day$1_$2
|
|
cp template.go ${filename}.go
|
|
cp template_test.go ${filename}_test.go
|
|
if [ "$(uname -s)" == "Linux" ]; then
|
|
sed -e "s/Dxx/Day$1/g" -i ./${filename}.go
|
|
sed -e "s/Dxx/Day$1/g" -i ./${filename}_test.go
|
|
sed -e "s/dayxx/day$1/g" -i ./${filename}_test.go
|
|
else
|
|
sed -e "s/Dxx/Day$1/g" -i "" ./${filename}.go
|
|
sed -e "s/Dxx/Day$1/g" -i "" ./${filename}_test.go
|
|
sed -e "s/dayxx/day$1/g" -i "" ./${filename}_test.go
|
|
fi
|
|
mkdir -p inputs
|
|
touch inputs/day$1
|
|
touch inputs/day$1_test1
|
|
touch inputs/day$1_test2
|
|
git add "inputs/day$1*" ${filename}*
|