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

Custom actions will not work if a custom $TODO_DIR is used

Open Matze1224 opened this issue 5 years ago • 3 comments

Do you want to request a feature or report a bug? A bug, but you may see it as a feature.

What is the current behavior? Using todo.txt with the debian packaging distribution, the folder is ~/.todo-txt. When using custom actions, there also contained in this folder. I can't be executed.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. Install todo.txt as debian package
  2. Create some custom action, may even only echos "Hello World"
  3. Try to execute this custom action with todo-txt

What is the expected behavior? To run the custom action without relinking the folder .todo-txt or some other quick fix.

The problem in the code: This is the hot spot:

if [ -z "$TODO_ACTIONS_DIR" ] || [ ! -d "$TODO_ACTIONS_DIR" ]
then
    TODO_ACTIONS_DIR="$HOME/.todo/actions"
    export TODO_ACTIONS_DIR
fi

The todo directory is hardcoded, so there is no chance to use the custom directory defined by the packaging author. To make this more adaptable, It would better to use the already existing variable $TODO_DIR (I think so).

Which versions todo.sh are you using?

Run todo.sh -V TODO.TXT Command Line Interface v2.11.0

Which Operating System are you using? Debian bullseye/testing

Which version of bash are you using?

Run bash --version GNU bash, Version 5.0.11(1)-release (x86_64-pc-linux-gnu)

Matze1224 avatar Feb 02 '20 17:02 Matze1224

You're right. So far, you would need to override the action dir location via TODO_ACTIONS_DIR as well. By defaulting to $TODO_DIR instead of hard-coding ~/.todo, this could be avoided. I don't see any downsides here, but it's one pitfall less. Goes into the same direction as #289.

inkarkat avatar Feb 02 '20 20:02 inkarkat

@inkarkat Is this a change which could be introduced before backlog has been cleaned?

chrysle avatar Mar 06 '23 11:03 chrysle

@chrysle There's little risk of merge conflicts in that area, yes. But to be honest our top priority has to be clearing the backlog of outstanding PRs, and anything that's blocking that (for example, the failing MacOS tests).

inkarkat avatar Mar 06 '23 14:03 inkarkat