Description
When solving Advent of Code puzzles, a common repetitive task is manually copying example inputs from the puzzle's markdown file and saving them in the data/examples directory. This process can be tedious and error-prone.
Proposed Solution
Introduce a command that scans the puzzle text for example inputs and writes them to files in data/examples.
Detection Method:
Example inputs are always presented as code blocks (enclosed within triple backticks ```).
In case of multiple code blocks, some may contain outputs, diagrams, or other non-input content. To handle this, the command can prompt the user interactively to confirm which blocks should be saved.
Naming Convention:
If only one input is accepted, it should be saved as ${day}.txt
.
If multiple inputs are extracted, they should be named ${day}-{part}.txt
.
Expected Workflow
- Run the command (e.g.,
cargo extract ${day}
). - The tool scans the puzzle markdown file for code blocks.
- If multiple blocks are found, the user is prompted to confirm which ones should be saved.
- Selected example inputs are saved with appropriate filenames.