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

Add a solutions column #15

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add a solutions column #15

wants to merge 3 commits into from

Conversation

miam-miam
Copy link

This PR adds an extra solution column that directly links to your solution file for the specific day.

Here someone has committed day 1 in their repo but has yet to commit day 2:

Day Solution Part 1 Part 2
Day 1 01.rs
Day 2

To facilitate this two new options were added to the Action:

  • solutionLocations which allows you to specify where each solution would be located relative to the readme file. (in the form "src/bin/{}.rs")
  • solutionPadding which can optionally pad your day numbers (1 becomes 01)

Unfortunately I was unable to create any tests (but I have tested locally) as the test framework just errors with TypeError: required field "lineno" missing from alias.

@premun
Copy link

premun commented Dec 13, 2023

@miam-miam100 I like this idea but I think it would be more flexible if you could provide a template with the path but have different placeholders so that it supports any repo. Examples:

  • src/{yyyy}/{d}.js
  • solutions/{yy}/Day_{dd}.fs

So that padding is driven by d or dd. Same for year being 2 or 4 digits.

@miam-miam
Copy link
Author

That could be an interesting idea, what do you think should be done if a user uses an incorrect template?
e.g. src/{yyy}/{ddd}.rs
I'm thinking about just completely ignoring them as otherwise we will need a way of escaping curly braces.

@premun
Copy link

premun commented Dec 14, 2023

I'd say that you just keep it simple and replace what you know. What is left, if left.

So {ddd} will be kept as {ddd}

@miam-miam
Copy link
Author

@premun Changed the logic so that the placeholders now work, unfortunately as I mentioned previously I haven't been able to add any tests (although I have tested it manually) as I couldn't get poetry working so you might want to do that.

@premun
Copy link

premun commented Jan 12, 2024

@miam-miam100 I am just a random person, I don't own this repo or anything. I might start using the workflow from your repo now :)

@premun
Copy link

premun commented Jan 12, 2024

Works great! Thanks!

https://github.com/premun/advent-of-code

@miam-miam
Copy link
Author

Oh 😂 my mistake. @k2bd if you could look at this PR that would be amazing.

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.

None yet

2 participants