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

Read only part 2 #50

Open
Ascyii opened this issue Dec 6, 2023 · 3 comments
Open

Read only part 2 #50

Ascyii opened this issue Dec 6, 2023 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Ascyii
Copy link

Ascyii commented Dec 6, 2023

It would be nice to have a flag for reading only part 2 of a puzzle.

@fspoettel fspoettel added enhancement New feature or request good first issue Good for newcomers labels Dec 6, 2023
@fspoettel
Copy link
Owner

The underlying aoc-cli does not have a flag for it. It should be simple enough to add this on our side, but I'm wondering if the upstream project wouldn't benefit from this as well.

Anyway, I would accept a PR that adds this on our side as well.

@AV3RG
Copy link

AV3RG commented Apr 12, 2024

Something I noticed is that once you have completed part 1, the part 2 is not saved automatically to the puzzle file. Doing cargo read <problem_no> after you have completed part 1 makes use of the aoc website/api and reads the puzzle from there but after that it does not save it to the puzzles file again. The puzzle file stays outdated

@AV3RG
Copy link

AV3RG commented Apr 12, 2024

Something I noticed is that once you have completed part 1, the part 2 is not saved automatically to the puzzle file. Doing cargo read <problem_no> after you have completed part 1 makes use of the aoc website/api and reads the puzzle from there but after that it does not save it to the puzzles file again. The puzzle file stays outdated

After looking into this issue seems to be because of the way aoc_cli handles the read command. In the code of the template we are using this code

pub fn read(day: Day) -> Result<Output, AocCommandError> {
    let puzzle_path = get_puzzle_path(day);

    let args = build_args(
        "read",
        &[
            "--description-only".into(),
            "--puzzle-file".into(),
            puzzle_path,
        ],
        day,
    );

    call_aoc_cli(&args)
}

But the issue is that the puzzle-file and description-only arguments don't mean anything for aoc-cli in this particular command, this command always uses the api and directly displays the puzzle from there. aoc read --day 2 --puzzle-file test.md Running this command does not make any test.md file and it looks like the puzzle-file argument is only for the download command. The code for running the read command inside aoc-cli does not show any use for this argument. This is something that should also be handled on our end and maybe on aoc-cli too if they feel like going in this direction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants