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

Add edit option to clear note #205

Merged
merged 1 commit into from
Sep 28, 2021
Merged

Conversation

fbuys
Copy link
Contributor

@fbuys fbuys commented Sep 14, 2021

Description

Closes: #164

A new flag (-c or --clear) clears the last entry's note or it can be used with the -i flag to clear another entry's note.

Motivation and Context

The regex used to see if a note has been provided cannot find empty
strings. It is therefore not possible to look for empty string to clear
a note.

How Has This Been Tested?

Added specs.

Created an entry with a note and cleared it with both -c and --clear.
Also turned note_editor on and confirmed that notes are cleared without the note editor opening again.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Closes: samg#164

The regex used to see if a note has been provided cannot find empty
strings. It is therefore not possible to look for empty string to clear
a note.

Instead a new flag (-c or --clear) clears the last entry's note or it
can be used with the -i flag to clear another entry's note.
@@ -247,14 +248,18 @@ def edit
end

if Config['note_editor']
if args['-z']
if args['-c']
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🥦 If -c is provided it will clear even if a note is provided. In other words clearing is prioritized.

@@ -340,6 +350,20 @@ def invoke command
expect(Timetrap::Timer.active_entry.note).to eq 'running entry//appended in editor'
end
end

context "clearing" do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🥦 Specs with the editor

@@ -211,6 +211,16 @@ def invoke command
expect(Timetrap::Timer.active_entry.note).to eq 'running entry//new//more'
end

it "should allow clearing the description of the active period" do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🥦 Specs similar to --append specs.

@dechimp dechimp merged commit 234fe37 into samg:master Sep 28, 2021
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.

Cannot remove note
2 participants