-
Notifications
You must be signed in to change notification settings - Fork 8
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 check for file existence #143
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
=======================================
Coverage 99.65% 99.66%
=======================================
Files 14 14
Lines 579 592 +13
=======================================
+ Hits 577 590 +13
Misses 2 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
if answer.lower() in ["n", "no", "nope"]: | ||
raise FileExistsError( | ||
"\n One or more files already exist in this folder." | ||
"\n Please remove them, or change to a different folder to continue" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This begs for a skip-existing flag...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have implemented --overwrite
.
This PR adds a simple check for if any of the filenames that will be created already exist. The user will be prompted if they do, and will be asked if they want to overwrite the files or not.
If they do not want to overwrite the files, a FileExistsError is thrown.
Closes #49, #76
Issue #49 mentions checking the file size, but this is not trivial, and would probably be more complex than is required here.
Additionally, I noticed that the config existence checker was not being run when making an era5cli request. I added this in and fixed the tests.