File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env sh
2
+
3
+ #
4
+ # Creates a new day solution template. Run from the root of the project.
5
+ #
6
+ # Parameters (all optional):
7
+ # - DAY -- day index defaulting to today
8
+ # - YEAR -- year defaulting to this year
9
+ # - SUFFIX -- suffix for the filename with solution. Don't forget the leading `-`.
10
+ #
11
+ # Assumes:
12
+ # - Y$YEAR/day-N.hs exists with a day solution template
13
+ #
14
+ # Effects:
15
+ # - Creates Y$YEAR/day-$DAY.hs from the template (see Assumes)
16
+ # - Adds an executable component day-$DAY to the cabal file of the year
17
+ #
18
+
19
+ : " ${YEAR:= $(date +% Y)} "
20
+ : " ${DAY:= $(date +% -d)} "
21
+ # : "${SUFFIX:=}"
22
+ DAYFILE=" day-$DAY$SUFFIX .hs"
23
+
24
+ cp " Y$YEAR /day-N.hs" " Y$YEAR /$DAYFILE "
25
+ echo -n "
26
+ executable day-$DAY
27
+ import: base
28
+ main-is: $DAYFILE
29
+ " >> Y$YEAR /y$YEAR .cabal
30
+
31
+ wget " https://adventofcode.com/$YEAR /day/$DAY " -O - | ./scripts/extract-html-code.hs > Y$YEAR /input/day-$DAY -small.txt
You can’t perform that action at this time.
0 commit comments