1
0
Fork 0

feat: patch README calendar with link to solution

This commit is contained in:
Sloane Perrault 2022-09-21 09:19:53 -04:00
parent c201f7ebe9
commit df609c1bae
2 changed files with 12 additions and 2 deletions

View file

@ -36,3 +36,5 @@ A behaviour for a solution to a puzzle. Must define a `solve/2` callback.
## [`AdventOfCode.PuzzleCase`](./test/support/puzzle_case.ex) ## [`AdventOfCode.PuzzleCase`](./test/support/puzzle_case.ex)
Case template defining an `assert_solution/2` helper. Case template defining an `assert_solution/2` helper.
<!-- links -->

View file

@ -48,6 +48,16 @@ defmodule Mix.Tasks.AdventOfCode.Gen.Solution do
create_file(part_test_file, part_test_contents) create_file(part_test_file, part_test_contents)
end end
day_regex = ~r/\W(#{day})\W/
readme_file = "README.md"
readme_contents = File.read!("README.md")
readme_contents =
"#{String.replace(readme_contents, day_regex, "[\\1]")}\n[#{day}]: ./#{day_file}\n"
File.write!(readme_file, readme_contents)
Mix.shell().info([:green, "* updating ", :reset, "README.md"])
_ -> _ ->
Mix.raise("Unknown arguments.") Mix.raise("Unknown arguments.")
end end
@ -58,8 +68,6 @@ defmodule Mix.Tasks.AdventOfCode.Gen.Solution do
@moduledoc """ @moduledoc """
Day <%= @day %> Day <%= @day %>
""" """
end end
defmodule <%= inspect(@mod) %>.Part1 do defmodule <%= inspect(@mod) %>.Part1 do