You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+27-14
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,13 @@ _Note:_
74
74
Part 1: error: todo - unimplemented in module aoc_2024/day_1 in function pt_1 at line 2
75
75
```
76
76
77
+
## Fetching problem inputs
78
+
79
+
When stubbing out a new day's solution with the `new` command, you can use the `--fetch` flag to tell gladvent to fetch your problem input from the advent of code website.
80
+
81
+
Some things to note:
82
+
- The `AOC_COOKIE` environment variable must be set with your advent of code session cookie.
83
+
- Gladvent will only attempt to fetch your input if the input file for the day being requested does not exist. This is to prevent accidental and redundant calls to the advent of code website, there should be no reason to fetch input data for the same day more than once.
77
84
78
85
## Reusable parse funtions
79
86
@@ -110,17 +117,18 @@ Gladvent makes it easy for you to define expected outputs in your `gleam.toml` f
110
117
Defining expectations is as simple as adding sections to your `gleam.toml` in the following format:
111
118
112
119
```toml
113
-
[gladvent.<yearasint>.<dayasint>]
114
-
pt_1 = <int or string>
115
-
pt_2 = <int or string>
120
+
[gladvent.<yearasint>]
121
+
1 = { pt_1 = <int or string>, pt_2 = <int or string> }
122
+
2 = { pt_1 = <int or string>, pt_2 = <int or string> }
123
+
3 = { pt_1 = <int or string>, pt_2 = <int or string> }
124
+
...
116
125
```
117
126
118
127
For example, to set the expectations for Dec 1st 2024 (2024 day 1) you would add something like:
119
128
120
129
```toml
121
-
[gladvent.2024.1]
122
-
pt_1 = 1
123
-
pt_2 = 2
130
+
[gladvent.2024]
131
+
1 = { pt_1 = 1, pt_2 = 2 }
124
132
```
125
133
126
134
When running, gladvent will detect whether a specific day has it's expectations set and if so will print out the result for you.
@@ -145,16 +153,21 @@ _Note_: gladvent will not compare your solution output against the expectations
145
153
146
154
### Why did you make this?
147
155
148
-
It seemed fun, I like small command line utilities and I wanted a way to get advent of code done in gleam without having the additional overhead of lots of copy-pasting and connecting things to get it to run
149
-
150
-
### Why does this not download the input from the advent of code website?
151
-
152
-
A few reasons:
153
-
154
-
1. I wanted to keep this utility as simple as possible to start with
155
-
2. I like the advent of code website and I felt like it was a shame to circumvent visiting it, especially since you should access it to read the daily challenge. On top of that, I would like to avoid spamming the `advent of code` api if possible.
156
+
It seemed fun, I like small command line utilities and I wanted a way to get advent of code done in gleam without having the overhead of lots of copy-pasting and connecting things to get it to run.
156
157
157
158
### Why run as a command line utility and not just use unit tests?
158
159
159
160
I thought a lot about that and I just prefer the overall interactivity of a CLI better, as well as allowing for endless runs or runs with configurable timeouts.
160
161
Having it run as part of `eunit` doesnt provide as much flexibility as I would like. Other testing frameworks have been popping up but I leave the decision to use them up to you!
162
+
163
+
### Why did you change your mind on fetching inputs?
164
+
165
+
I started to reflect a bit after gladvent's users kept asking for the feature...
166
+
167
+
While my initial rationale was twofold:
168
+
1. To encourage people to use the advent of code website, and I felt like fetching inputs somehow took away from that.
169
+
2. To minimise the risk that people would use a tool I made to spam the advent of code website with requests.
170
+
171
+
Fetching inputs in a smart way (only ever if your input file does not already exist, so you should only need to do it once per day) still requires users to visit the advent of code website for the following (things gladvent will never do):
0 commit comments