Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(scaffold): overwrite argument #63

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

Merged
fspoettel merged 1 commit into fspoettel:main from AV3RG:main
Oct 31, 2024
Merged

feat(scaffold): overwrite argument #63

fspoettel merged 1 commit into fspoettel:main from AV3RG:main
Oct 31, 2024

Conversation

@AV3RG
Copy link
Contributor

@AV3RG AV3RG commented Feb 22, 2024
edited
Loading

Solves #62

Copy link
Owner

Hey @AV3RG, thanks for the PR. This looks like a good addition. Lmk once this is ready for review and I'll take a closer look.

AV3RG reacted with thumbs up emoji

Copy link
Contributor Author

AV3RG commented Apr 12, 2024

Hey I just tested it and it works

The only change I could see that could be made is change the safe_create_file function to something like this

fn safe_create_file(path: &str, overwrite: bool) -> Result<File, std::io::Error> {
 let mut open_options = OpenOptions::new().write(true);
 if overwrite {
 open_options = open_options.create(true).truncate(true);
 } else {
 open_options = open_options.create_new(true);
 }
 open_options.open(path)
}

Or by using a match statement, otherwise it works

@AV3RG AV3RG marked this pull request as ready for review April 12, 2024 11:57
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /