Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/breakthatbass/eggnog
🎅🏻 Download inputs, puzzle directions, & submit answers to Advent of Code puzzles in your terminal
https://github.com/breakthatbass/eggnog
advent-of-code christmas cli game libcurl
Last synced: 3 months ago
JSON representation
🎅🏻 Download inputs, puzzle directions, & submit answers to Advent of Code puzzles in your terminal
- Host: GitHub
- URL: https://github.com/breakthatbass/eggnog
- Owner: breakthatbass
- License: mit
- Created: 2021-04-05T17:47:39.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-10T13:44:05.000Z (about 3 years ago)
- Last Synced: 2024-10-01T02:41:11.613Z (4 months ago)
- Topics: advent-of-code, christmas, cli, game, libcurl
- Language: C
- Homepage:
- Size: 959 KB
- Stars: 17
- Watchers: 2
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eggnog 🎄
Yet another Advent of Code CLI tool...`eggnog` is a tool that allows you to download [Advent of Code](https://adventofcode.com) puzzle inputs, puzzle directions, and submit answers in the terminal.
It caches everything - even when a wrong answer is submitted.
### Installation
`eggnog` works on MacOS and Linux.Set the `NOG_INSTALL_PATH` environment variable.
```
# an installation option...
export NOG_INSTALL_PATH=/usr/local/bin
```
Then run
```
make install
```
### Dependencies
It relies on the [`libcurl`](https://curl.se/libcurl/) C library for http requests. Chances are it's already installed and you don't have to do anything. But if it doesn't work you may have to download it.**MacOS**
```
brew install curl
```
**Linux**
```
sudo apt update
sudo apt-get install libcurl4-gnutls-dev
# or whatever packager you use
```
#
## Run Tests
```
make tests
```
#
## Usage
```
nog [--day= --year=] [OPTION]
```Day & year are required unless Advent is happening - latest puzzle will automatically
be returned.
```
-y , --year=
The year of the puzzle you want to do.-d , --day=
The day of the puzzle you want to do.
```**Options**:
If no options are supplied, input is assumed.
```
-i, --input
Download puzzle input.-p, --directions
Get puzzle directions.-s, --submit=
submit an answer to a puzzle. If no answer is supplied, read from
stdin. Using '-s' automatically reads from stdin.-l , --level=
Indicate whether submitting an answer to part 1 or part 2 of a puzzle.
If left out, part 1 is assumed. **Required for submitting part 2 answers**.
```
Getting the puzzle input will print it to the terminal in the same way it would with `curl`.
The purpose of that is because many advent of code solutions read from `stdin` rather than a hardcoded file name in the code.### Example usage
Get input for year 2020 day 1:
- `nog -y 2020 -d 1`
- or save to a file --> `nog -y 2020 -d 1 > input.txt`
- or pipe it into your program --> `nog -y 2020 -d 1 | ./myprogram`Submit an answer for year 2020 day 1 part 1:
- `nog -y 2020 -d 1 --submit=1234`Or read from `stdin` to provide your answer:
- `./myprogram | nog -y 2020 -d 1 -s`Submit an answer for part 2:
- `nog -y 2020 -d 1 -l 2 -s`## Cache
`eggnog` creates a local cache in the `$HOME` directory called `.eggnog`.Puzzle directions, inputs, and all right and wrong answer submission attempts are saved. The cache is always checked before querying Advent of Code servers.
Unless the cache is deleted, any query to the servers happens only once.
## To Do
- WHen submitting an answer, if it's wrong, record the time. Require at least a minute to pass before sending another answer attempt.## Known Bugs
- The bug that prevented from submitting answers to part 2 has been fixed ✔️## Contributing
If you would like to contribute, feel free to make a pull request.
Or if you find a bug, open an issue.