-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8f6f223
Showing
9 changed files
with
503 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target | ||
day*/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "gen-aoc" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
clap = { version = "4.5.1", features = ["derive"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
PROJECT_NAME := gen-aoc | ||
|
||
all: build | ||
|
||
build: | ||
cargo build | ||
|
||
build-release: | ||
cargo build --release | ||
|
||
run: build | ||
./target/debug/$(PROJECT_NAME) | ||
|
||
run-release: build-release | ||
./target/release/$(PROJECT_NAME) | ||
|
||
lint: | ||
cargo clippy | ||
|
||
clean: | ||
cargo clean | ||
|
||
.PHONY: all build build-release run run-release lint clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Features | ||
|
||
Generates a shiny new project folder for your chosen day of AOC madness | ||
Automates boilerplate code and tests in Go (we're still working on the whole 'multiple languages' thing) | ||
|
||
|
||
## Usage (it's so easy, even a reindeer could do it) | ||
|
||
```bash | ||
./gen-aoc --day <day_number> --lang <lang> | ||
``` | ||
```bash | ||
--day: The AOC puzzle you're about to tackle | ||
``` | ||
```bash | ||
--lang: Currently only supports go | ||
``` | ||
```bash | ||
--fresh: If you want a sparkling clean start, this flag wipes out any existing code | ||
``` | ||
## Disclaimer | ||
AOC Bootstrap won't magically solve the puzzles for you (darn!). But it'll give you a head start and maybe a chuckle or two. | ||
Built with laziness and a sprinkle of procrastination | ||
We know you'd rather be coding than setting up projects. Happy Advent of Code! 🎁 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use clap::Parser; | ||
|
||
#[derive(clap::ValueEnum, Clone, Debug)] | ||
pub enum Langs { | ||
Go, | ||
} | ||
|
||
#[derive(Parser)] | ||
pub struct Cli { | ||
/// Day of AoC to get, must be between 1 and 25 | ||
#[arg(short, long, default_value = "1")] | ||
day: u32, | ||
/// Language for template | ||
#[arg(short, long, default_value = "go")] | ||
lang: Langs, | ||
/// Sometimes we all need a fresh start, passing this flag will overwrite existing files | ||
#[arg(short, long, default_value = "false")] | ||
fresh: bool, | ||
} | ||
|
||
impl Cli { | ||
pub fn new() -> Self { | ||
let args = Cli::parse(); | ||
match args.day { | ||
1..=25 => {} | ||
_ => panic!("Day must be between 1 and 25"), | ||
} | ||
Self { | ||
day: args.day, | ||
lang: args.lang, | ||
fresh: args.fresh, | ||
} | ||
} | ||
pub fn day(&self) -> u32 { | ||
self.day | ||
} | ||
pub fn lang(&self) -> Langs { | ||
self.lang.clone() | ||
} | ||
pub fn fresh(&self) -> bool { | ||
self.fresh | ||
} | ||
} | ||
|
||
impl Default for Cli { | ||
fn default() -> Self { | ||
Cli::new() | ||
} | ||
} |
Oops, something went wrong.