Merged
Conversation
…xists. Refactor flags and existence validation logic
smoelius
reviewed
Jun 27, 2023
Collaborator
smoelius
left a comment
There was a problem hiding this comment.
My comments are all very nit-picky. I think the logic looks really solid.
|
|
||
| if must_not_exist && exists { | ||
| bail!( | ||
| let nodb_msg = |flag: &str| { |
Collaborator
There was a problem hiding this comment.
Suggested change
| let nodb_msg = |flag: &str| { | |
| let no_db_msg = |flag: &str| { |
| bail!( | ||
| let nodb_msg = |flag: &str| { | ||
| format!( | ||
| "No sqlite database found at {:?} to {}; creating new database", |
Collaborator
There was a problem hiding this comment.
Suggested change
| "No sqlite database found at {:?} to {}; creating new database", | |
| "No sqlite database to {} at {:?}; creating new database", |
I think putting the operation first will make it more noticeable.
| ); | ||
| ), | ||
| (false, true, _, _) => bail!( | ||
| "No sqlite database found at {:?}; please remove the --dump flag", |
Collaborator
There was a problem hiding this comment.
Suggested change
| "No sqlite database found at {:?}; please remove the --dump flag", | |
| "--dump was passed, but no sqlite database was found at {:?}", |
This is pretty nitpicky, but "remove the --dump flag" sounds like it's going to solve the user's problems, when they probably have bigger problems.
Collaborator
|
Actually, one other nice-to-have would be
But that could be a separate PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the dump, reset, resume flag, and database existence validation logic. It now does the following:
--dumpflag when the database does not exist--resumeor--resetflag, and the database does not existcloses #119
Reading on the
trycmdtests to create one for this PR