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

todo.sh replace using STDIN: remove priority prefix #386

Closed
wants to merge 5 commits into from

Conversation

Pegasust
Copy link

Changes

  • Remove the priority prefix when todo.sh replace <ID> with stdin input
  • Add Cygwin little fix for t8010-listaddons.sh
    • Remove the actions that are supposedly skipped before executing the next tests

Previously

The portion surrounded by {} is the initial input provided

$ ./todo.sh add "(A) new task"
$ ./todo.sh replace 1
Replacement: {(A) new task}
1 (A) new task
TDOO: Replaced task with:
1 (A) (A) new task

After

$ ./todo.sh add "(A) new task"
$ ./todo.sh replace 1
Replacement: {new task}
1 (A) new task
TODO: Replaced task with:
1 (A) new task

Before submitting a pull request, please make sure the following is done:

  • Fork the repository and create your branch from master.
  • If you've added code that should be tested, add tests!
  • Ensure the test suite passes.
  • Format your code with ShellCheck.
  • Include a human-readable description of what the pull request is trying to accomplish.
  • Steps for the reviewer(s) on how they can manually QA the changes.
  • Have a fixes #XX reference to the issue that this pull request fixes.

inkarkat added a commit to inkarkat/todo.txt-cli that referenced this pull request Jun 17, 2022
So that any combination of priority / date entered in the replacement will replace the corresponding original ones, but if they are left out, the original ones will be kept.
In essence, omitted stuff will be kept, added stuff will override, only deletion of existing stuff is not possible (but this is replace, after all).

Fixes todotxt#386
@inkarkat
Copy link
Member

Good catch! The duplicated priority indeed is a bug.

I think that ignoring an entered priority is the wrong solution; instead, that priority should replace an existing one, like with dates. You unfortunately did not add any new tests that show the new behavior (and instead deleted and then restored an existing test, and added other unrelated stuff in the PR - please do separate submittals in the future!)

In #387, I've reworked the replacement algorithm to do a pull merge of priority + date (and added tests to show the new behavior). How do you like that?

Copy link
Member

@inkarkat inkarkat left a comment

Choose a reason for hiding this comment

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

Approach questionable; no tests added; unrelated changes.

@inkarkat
Copy link
Member

Regarding 1a2a8ed (#386): The gitignore doesn't have any editor-specific settings; I think things like ignoring .vscode folder should go into a user-specific ~/.gitignore instead.

Regarding e4708d9 (#386): I don't understand the motivation for removing the dummy action for test skips; why is that a problem?

@Pegasust
Copy link
Author

Thanks for reviewing my code.

Regarding the removal of the dummy action for test skips, to put it simply, the test above supposedly produces a side-effect (remove foo from list of action). The skipping mechanism doesn't produce this side-effect, while the test below it (not skipped) assumes this side-effect. So the test after it fails.

Regarding the editor-specific settings, I think your argument is valid.

I'll take a look at your PR. Meanwhile, may I ask how do you include the specific commit into these comments (like e4608d9 (#386))

@Pegasust
Copy link
Author

Hi @inkarkat, my changes are only related to the interface given to the STDIN and are consistent with the behavior of the command. Hence, it is hard to test for what is given from read -i as it effectively pre-injects into stdin.

Before making these changes, I have also considered whether to change the behavior of todo.sh replace to also replace priority, but there seems to be a competing command to do so: todo.sh pri <num> <new-priority>.

In all honesty, I prefer your changes in #387 a lot better than the current behavior.

@inkarkat
Copy link
Member

Regarding the removal of the dummy action for test skips, to put it simply, the test above supposedly produces a side-effect (remove foo from list of action). The skipping mechanism doesn't produce this side-effect, while the test below it (not skipped) assumes this side-effect. So the test after it fails.

Ah, I understand the problem now. Well spotted, thank you! I used to use Cygwin, but have switched to Ubuntu a long time ago; unfortunately, we still don't have a CI build on Cygwin (and embarassingly, the MacOS builds have been broken for a long time (@karbassi - any updates here?)), so this hasn't been noticed.

I've taken your commit, added some explanation and a small refactoring on top, and separately submitted that as #388.

@inkarkat
Copy link
Member

how do you include the specific commit into these comments (like e4608d9 (#386))

Oh, that's just GitHub magic. On the /Commits\ tab on this PR, you just copy the URL to a particular commit.

@inkarkat
Copy link
Member

In all honesty, I prefer your changes in #387 a lot better than the current behavior.

Great, thank you! If @karbassi agrees, we'll incorporate that extension of the behavior then.

With your Cygwin test fix in a separate PR (#388), there's then nothing left to be handled here, so I'm closing this PR.

Thanks for your bug report, fix, and explanations; I hope you'll enjoy todo.sh as much as we do!

@inkarkat inkarkat closed this Jun 18, 2022
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.

None yet

2 participants