8000 Readme by jwnpoh · Pull Request #155 · dominikbraun/timetrace · GitHub
[go: up one dir, main page]

Skip to content
155
Merged
dominikbraun merged 3 commits into
dominikbraun:mainfrom
jwnpoh:readme
Jul 5, 2021
Merged

Readme#155
dominikbraun merged 3 commits into
dominikbraun:mainfrom
jwnpoh:readme

Conversation

@jwnpoh
@jwnpoh jwnpoh commented Jul 4, 2021
Copy link
Copy Markdown
Contributor

This PR addresses:

  1. typos in the --revert help messages, change it's to its.
  2. My earlier PR timetrace delete commands: Default to no when asking for confirmation #147 failed to include the check for --yes flag in deleteProjectCommand. This PR fixes that.

@aligator aligator left a comment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR.

I have just a small change request.

Comment thread cli/delete.go Outdated
Comment on lines 58 to 63
if !confirmed {
if !askForConfirmation() {
out.Info("Project NOT deleted.")
return
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that be a bit nicer code? Avoid stacked ifs if possible and feasible.

Suggested change
if !confirmed {
if !askForConfirmation() {
out.Info("Project NOT deleted.")
return
}
}
if !confirmed && !askForConfirmation() {
out.Info("Project NOT deleted.")
return
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that makes sense. In fact, I was merely mindlessly copying the if-logic from the deleteRecordCommand and did not even think that there was a cleaner way to do it. I will submit another commit with an edit to deleteRecordCommand as well.

@jwnpoh jwnpoh Jul 5, 2021 •
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While discussing code style, I also refactored the if options.Revert checks to remove the else statement for cleaner code, following the advice from https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88.

Please have a look at the new commit and let me know if that's alright!

@dominikbraun dominikbraun added this to the timetrace v0.11.x milestone Jul 5, 2021
@dominikbraun dominikbraun left a comment
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! The best else-blocks are the else-blocks that don't exist 😎

This fix will be included in the next patch release later today.

@dominikbraun
dominikbraun merged commit 65d160e into dominikbraun:main Jul 5, 2021
@dominikbraun
Copy link
Copy Markdown
Owner

This PR is included in timetrace v0.11.1.

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

Successfully merging this pull request may close these issues.

3 participants

0