mirror of
https://github.com/ZeusWPI/Advent-of-Code-Aggregator.git
synced 2024-11-22 06:51:10 +01:00
add args checking and feedback
This commit is contained in:
parent
bc6612cb87
commit
e15f38de00
1 changed files with 20 additions and 2 deletions
|
@ -1,14 +1,32 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
help()
|
||||||
|
{
|
||||||
|
echo $0 [day] [part]
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! test -n "$1"; then
|
||||||
|
echo "'day' is not given" >&2
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
day="$(printf '%02d' ${1##0})"
|
day="$(printf '%02d' ${1##0})"
|
||||||
|
|
||||||
|
if ! test -n "$2"; then
|
||||||
|
echo "'part' is not given" >&2
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
part="$2"
|
part="$2"
|
||||||
|
|
||||||
inputfile="$PWD/inputs/${day}.txt"
|
inputfile="$PWD/inputs/${day}.txt"
|
||||||
|
|
||||||
if ! test -f "$inputfile"; then
|
if ! test -f "$inputfile"; then
|
||||||
echo "no input available" >&2
|
echo "no input available at '$inputfile'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "Running benchmarks for day $day part $part"
|
||||||
for dir in *; do
|
for dir in *; do
|
||||||
if test -d "$dir"; then
|
if test -d "$dir"; then
|
||||||
cd "$dir"
|
cd "$dir"
|
||||||
|
|
Loading…
Reference in a new issue