mirror of
https://github.com/cupcakearmy/advent-of-code.git
synced 2024-11-01 08:04:12 +01:00
hygen rust
This commit is contained in:
parent
3af5af2461
commit
eb723f5112
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
> New days are generated with [`hygen`](https://github.com/jondot/hygen).
|
> New days are generated with [`hygen`](https://github.com/jondot/hygen).
|
||||||
>
|
>
|
||||||
> `hygen riddle new --year 2021 --day 01`
|
> `bun run gen --year 2022 --day 1`
|
||||||
|
10
_templates/riddle/new/cargo.ejs.t
Normal file
10
_templates/riddle/new/cargo.ejs.t
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
inject: true
|
||||||
|
to: cargo.toml
|
||||||
|
before: "# INJECT HERE"
|
||||||
|
skip_if: <%= id %>
|
||||||
|
---
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "<%= id %>"
|
||||||
|
path = "<%= dir %>/rust/main.rs"
|
@ -12,6 +12,13 @@ async function getInput(year, day) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
params: async ({ args }) => {
|
params: async ({ args }) => {
|
||||||
return { ...args, input: await getInput(args.year, args.day) }
|
const day = args.day.toString().padStart(2, '0') // Padded
|
||||||
|
return {
|
||||||
|
...args,
|
||||||
|
id: `${args.year}-${day}`,
|
||||||
|
dir: `./${args.year}/${day}`,
|
||||||
|
input: await getInput(args.year, parseInt(day)),
|
||||||
|
day,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/input.txt
|
to: <%= dir %>/input.txt
|
||||||
unless_exists: true
|
unless_exists: true
|
||||||
---
|
---
|
||||||
<%= input %>
|
<%= input %>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/python/main.py
|
to: <%= dir %>/python/main.py
|
||||||
unless_exists: true
|
unless_exists: true
|
||||||
---
|
---
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/README.md
|
to: <%= dir %>/README.md
|
||||||
unless_exists: true
|
unless_exists: true
|
||||||
---
|
---
|
||||||
|
|
||||||
|
9
_templates/riddle/new/rust.ejs.t
Normal file
9
_templates/riddle/new/rust.ejs.t
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
to: <%= dir %>/rust/main.rs
|
||||||
|
unless_exists: true
|
||||||
|
---
|
||||||
|
fn main() {
|
||||||
|
// Part A
|
||||||
|
let contents = include_str!("../test.txt").trim();
|
||||||
|
println!("A: {}", contents);
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/test.txt
|
to: <%= dir %>/test.txt
|
||||||
unless_exists: true
|
unless_exists: true
|
||||||
---
|
---
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"scripts": {
|
||||||
|
"gen": "bun hygen riddle new"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.0",
|
"axios": "^1.6.0",
|
||||||
"hygen": "^6.2.11"
|
"hygen": "^6.2.11"
|
||||||
|
Loading…
Reference in New Issue
Block a user