Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CLI + Credential storing tools + Input downloading tools #1

Merged
merged 3 commits into from
Nov 29, 2018
Merged

Refactor CLI + Credential storing tools + Input downloading tools #1

merged 3 commits into from
Nov 29, 2018

Conversation

AlisCode
Copy link
Contributor

This PR implements my refactoring of the application using CLAP. 🎬

We now have 2 subcommands (cargo aoc credentials and cargo aoc input) that will get matched by CLAP and handled correctly in the AOCApp struct (app.rs), which is basically just a wrapper for the core functions, and a place to store the state of the app in, if it ever gets any (more?) complex.

Credentials are handled using the CredentialsManager struct in credentials.rs. The error handling looks good to me, at least we have cool error messages, and no unexpected crash.

Implemented an AOCDate struct in date.rs - that actually might be better off being placed in aoc_runner_internal 💁‍♀️ - It's meant to handle the day and year so we can grab the input from AoC's website.

The Credentials command stores the credentials in a file located next to the binary of cargo aoc. Potential users wouldn't like their token being accidentally exposed in their working directory, lol.

The Input command sends a GET query, setting the cookie beforehand. It then creates the file-tree and stores the result of the query in a file, thus generating input/{year}/day_{day}.txt

--
Also, added a small yet cool README.md to give users a hint on how to use this wonderful tool 👍

…mand credentials to store the credentials + added subcommand input + AOCDate struct
@gobanos gobanos merged commit edaeeba into gobanos:master Nov 29, 2018
gobanos added a commit that referenced this pull request Oct 28, 2019
gobanos added a commit that referenced this pull request Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants