Skip to content

Latest commit

 

History

History
120 lines (83 loc) · 4.19 KB

README.rst

File metadata and controls

120 lines (83 loc) · 4.19 KB

Advent Of Code to Markdown

Total number of downloads PyPI PyPI - Python Version

Parses Advent Of Code problem statement to markdown with option to also download the input while keeping everything organised.

✨ Features

  1. Parses the problem statement to Markdown.
  2. Easily organize your solutions with the input and a markdown description.
  3. Boilerplate can be copied next to the input and the problem statement.
  4. You can execute this script for the same day as many times as you want and feel confident that the boilerplate will not change what you have done so far.

🧹 Organisation

Each day goes inside a folder with the syntax day-<day> as you can check below.

|____day-01
| |____README.md
| |____input.txt
|____day-02
| |____README.md
| |____input.txt
...
|____day-15
| |____README.md
| |____input.txt
|____day-16
| |____README.md
| |____input.txt
...
|____day-24
| |____README.md
| |____input.txt
|____day-25
| |____README.md
| |____input.txt

This was generated by executing aoc-to-markdown -i -s 25 times. Additional arguments could have been provided to copy a directory/file inside the folder (useful to set up everything for you to solve). You can also specify the output directory (where the folders will be created), but, in this example, this was also not given.

🐍 Installation

If you want to install directly from this repository, then install the dependencies and you are good to go:

pip install -r requirements.txt

python aoc_to_markdown.py -h

If you want even simpler, then download from PyPi and you are good to go:

pip install aoc-to-markdown

aoc_to_markdown -h

📖 Arguments

Usage: aoc-to-markdown [-h] [-y <year>] [-d <day>] [-o <output_dir>] [-b <boilerplate_dir>] [-s] [-i]
 -h, --help          Optional parameter to print this message
 -y, --year          Optional parameter to indicate the year of the problem
 -d, --day           Optional parameter to indicate the day of the problem
 -o, --output        Optional parameter to indicate the path of the output (default = ".")
 -b, --boilerplate   Optional parameter to copy a directory/file to the output
 -s, --save          Optional argument to indicate that the markdown should not be printed to stdout, but to a file
 -i, --input         Optional argument to indicate that the input is to be downloaded and saved to a file

SESSION_ID environment flag is required to download part 2 of the problem. This session id can be copied from the requests made on the Advent Of Code website after you login.

Extended description:
--year, if not given, defaults to the current year if in december; otherwise is the current year
--day, if not given, defaults to the first day which has not been retrieved (checks for directories named "day-<day>"); if all days have been retrieved, then go drink some hot chocolate and enjoy the rest of the day
--output is the prefix path where the folder (syntax: "day-<day>") will be created
--boilerplate is an argument useful to copy the solution boilerplate to help you get started
--save is only necessary if you want to save directly to a file and --output is not given

Example:
aoc-to-markdown -y 2018 -d 1 -o my-solution-directory -b my-boilerplate -i

👨‍💻 Similar