mix aoc.get (Advent of Code Utils v1.0.0) View Source

Fetch the input of the AOC challenge for a given day / year.

This mix task fetches the inputs for the advent of code challenge of a specific day. The day and year of the challenge can be passed as command-line arguments or be set in the advent_of_code_utils application configuration. When neither is present, the current date is used.

By default, this task stores the fetched data in input/<year>_<day>.txt. If this file already exists, no input is fetched. The destination path can be modified by setting the value of :input_path in the advent_of_code_utils application. This value should be set to a string which may contain :year and :day. These values will be replaced by the day and year of which the input is fetched.

For instance, the following configuration will store the fetched data in my_input/<year>/<day>.input:

config :advent_of_code_utils, :code_path, "my_input/:year/:day.input"

In order to fetch your input, this task needs your advent of code session cookie. This can be obtained by investigating your cookies after logging in on the advent of code website. The cookie can be stored inside your config/config.exs file (e.g. config, :advent_of_code_utils, :session, "<your cookie here>") or it can be passed as a command-line argument. If no cookie is present, the input can not be fetched.

Command-line arguments

The options below take precedence over values defined in the application configuration.

  • -s or --session: Specify the session cookie.
  • -y or --year: Specify the year.
  • -d or --day: Specify the day.

Link to this section Summary

Functions

Callback implementation for Mix.Task.run/1.

Link to this section Functions

Callback implementation for Mix.Task.run/1.