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

Don’t overwrite default.nix if it’s not explicitely given as input #14

Closed
Profpatsch opened this issue Jul 22, 2019 · 2 comments
Closed

Comments

@Profpatsch
Copy link

It’s kind of in bad taste to overwrite existing files if the user has not explicitely specified they should be overwritten (that is by adding arguments with their name).

@kolloch
Copy link
Collaborator

kolloch commented Jul 23, 2019

It's the unix way! (at least partially kidding)

Anyways, I think it is quite common to overwrite an existing file in this case because you update your file. But for default.nix it is probably not such a great choice.

I could

  • Follow your suggestion and require an overwrite flag.
  • Look for a string like "Generated by crate2nix" and only overwrite if it is there.
  • Change the default to Cargo.nix so that it is unlikely that it is used already for something else.

What do you think?

@Profpatsch
Copy link
Author

I would just add a check if the user doesn’t specify anything explicitely; so:

crate2nix generate -o default.nix => overwrite file without a warning
crate2nix generate => if default.nix exists, abort with exists error, if not, just write to it.

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

No branches or pull requests

2 participants