todo.txt-cli icon indicating copy to clipboard operation
todo.txt-cli copied to clipboard

fix: Improve GNU sed fallback

Open hyperupcall opened this issue 1 year ago • 0 comments

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

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

Code inspired by this comment, this PR fixes the sed command on BSD/Busybox, etc. platforms in which GNU sed is not used.

Unlike what some comments in the linked issue suggests, the approach of exporting the function so todotxt add-ons can automatically use the fix was not done. This is because that would be a breaking change and there is no way we can guarantee that the assumptions of this sed() function hold true for all plugin code.

How to test:

make test

Closes #168

hyperupcall avatar Aug 26 '23 04:08 hyperupcall