View Source mix aoc.gen (Advent of Code Utils v2.0.1)

Create a code skeleton for the AOC challenge of a given day / year.

This mix task creates a code skeleton 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 of these are present, the current date is used.

By default, this task stores the generated code skeleton in lib/<year>/<day>.ex. If this file already exists, an error is returned and no files are created. The destination path can be modified by setting the value of :code_path in the advent_of_code_utils application configuration. This value should be set to a string which may contain :year and :day. These values will be replaced by the day and year for which a skeleton is generated.

For instance, the following configuration will store the generated code in lib/aoc_<year>_day_<day>.ex:

config :advent_of_code_utils, :code_path, "lib/aoc_:year_day_:day.ex"

command-line-arguments

Command-line arguments

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

  • -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.