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

Combinations of --change-time, --delete, and --edit don't work consistently #1696

Closed
micahellison opened this issue Mar 1, 2023 · 0 comments · Fixed by #1669
Closed

Combinations of --change-time, --delete, and --edit don't work consistently #1696

micahellison opened this issue Mar 1, 2023 · 0 comments · Fixed by #1669
Labels
bug Something isn't working 📌 This can't go stale
Milestone

Comments

@micahellison
Copy link
Member

Diagnostic output

jrnl: v3.3
Python: 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
OS: Windows 10

Current Behavior

Pretty much any combination of --change-time, --delete, and --edit in the same jrnl call leads to unpredictable results.

We have a couple issues about very specific combinations (#1639, #1644), but I wanted to file a broader issue around this to precisely specify the expected behavior so users reading the changelog know what to expect without digging into the code or PR comments.

Expected Behavior

When I run any combination of --change-time, --delete, and --edit, I expect this result, in this order, on the whole journal, or just in the search results if I use search criteria in my jrnl call:

  • If I entered --change-time, I will first be prompted to change the time of each entry
  • If I entered --delete, I will then be prompted to delete each each entry
  • If I entered --edit, my editor will open with the results of the previous actions, and I can modify, remove, or append entries in my editor.
  • When this is finished, I will see a precise count of each entry added, modified, or deleted by all the actions above.

Repro Steps

I've already specified this in a BDD test for our test journals, which start out with 3 entries:

    Scenario Outline: Combining --change-time and --delete and --edit affects appropriate entries
        Given we use the config "<config_file>"
        And we append to the editor if opened
        	[2023-02-21 10:32] Here is a new entry
        And we use the password "test" if prompted
        # --change-time is asked first, then --delete, then --edit
        When we run "jrnl --change-time '2022-04-23 10:30' --delete --edit" and enter
            N
            Y
            Y
            Y
            Y
            N
        Then the error output should contain "3 entries found"
        And the error output should contain "2 entries deleted"
        And the error output should contain "1 entry modified" # only 1, because the other was deleted
        And the error output should contain "1 entry added" # by edit
        When we run "jrnl -99 --short"
        Then the output should be
            2022-04-23 10:30 The third entry finally after weeks without writing.
            2023-02-21 10:32 Here is a new entry

Debug output

n/a

Other Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📌 This can't go stale
Projects
None yet
1 participant