VladimirMarkelov / ttdl

TTDL - Terminal Todo List Manager
MIT License
209 stars 17 forks source link

Unexpected different list outputs #35

Closed eugnma closed 4 years ago

eugnma commented 4 years ago

Here the way to reproduce the behavior:

$ cat ttdl-cat
#!/bin/sh
cat
$
$ cat todo.txt
2020-07-21 TEST @update due:2020-07-21 aa:11 bb:22 rec:1y cc:33
2020-07-21 TEST @update due:2020-07-21 aa:11 bb:22 rec:1y cc:33 !cat:true
$
$ ttdl
# D P Created    Finished   Due        Subject
-----------------------------------------------
1 R   2020-07-21            2020-07-21 TEST @update rec:1y
2 R   2020-07-21            2020-07-21 TEST @update !cat:true aa:11 bb:22 cc:33
-----------------------------------------------
2 todos (of 2 total)

The first item doesn't include aa:11 bb:22 cc:33, and the second item doesn't include rec:1y, should be the only difference is including !cat:true for the second output in this case?

VladimirMarkelov commented 4 years ago

I have reproduced it. I'll debug this one. Thanks for the issue.

VladimirMarkelov commented 4 years ago

The current situation:

the first item doesn't include aa:11 bb:22 cc:33

TTDL expects the plugin to returns all tags. If a plugin does not return any tag in the list, the tag is removed from the output. It was done intentionally for plugins that want to remove or add tags depending on value of another tags (it is not restricted to tags starting with "!" - a plugin can change or remove any tag).

E.g, if you just print in *.sh file what you have recieved, a Window example of such plugin:

# ttdl-cat.bat
for /F "tokens=*" %%a in ('more') do (
echo %%a
)

If prints all tags as expected.

the second item doesn't include rec:1y

I do not remember why, but when any tag with ! is detected it skips the tag rec: in output. I disabled passing rec: to plugins and now the tag is displayed always - it is in the latest master.

eugnma commented 4 years ago

It's OK for me prints all tags with plugins, and keep the current behavior for outputs without plugins, just curious, is there any reason the tags (e.g. aa:11 bb:22 cc:33) are omitted from outputs previously?

VladimirMarkelov commented 4 years ago

Ah, sorry. I checked incorrect line in my output. I have two similar strings. One had !cat: and another one did not. I double-check and I see that in a line that does not include any ! command misses all custom tags.

Thanks for the issue!

VladimirMarkelov commented 4 years ago

I hope it is fixed in the current master. I thought task subject would include all custom tags but I was wrong. Now I add all custom tags if a line does not have any plugin command. It may show tags in order that differs from original one, but all tags should be shown now.

eugnma commented 4 years ago

👍 It's working like a charm!