Skip to content

Commit 076cef8

Browse files
committed
fetch: Name input for the specific day
Slight ergonomics here, in case I forget to delete the previous input before fetching the current day's.
1 parent c6afe39 commit 076cef8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
secrets
2-
input
2+
input[0-9]*

fetch.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ fi
2121
daypad=$(seq -f%02g $day $day)
2222

2323
if [ "$yes" = "1" ]; then
24-
if [ -f input ]; then
24+
if [ -f input$day ]; then
2525
echo "THE INPUT ALREADY EXISTS!!!"
2626
else
27-
curl --cookie session=$(cat secrets/session) -o input http://adventofcode.com/2016/day/$day/input
27+
curl --cookie session=$(cat secrets/session) -o input$day http://adventofcode.com/2016/day/$day/input
2828
fi
2929
else
30-
curl -o input http://example.com
30+
curl -o input$day http://example.com
3131
fi
3232

3333
if [ -f $daypad.rb ]; then
@@ -37,7 +37,7 @@ if [ -f $daypad.rb ]; then
3737
fi
3838

3939
if [ -f TEMPLATE.rb ]; then
40-
cat TEMPLATE.rb input > $daypad.rb
40+
cat TEMPLATE.rb input$day > $daypad.rb
4141
elif [ -f t.rb ]; then
42-
cat t.rb input > $daypad.rb
42+
cat t.rb input$day > $daypad.rb
4343
fi

0 commit comments

Comments
 (0)