VladimirMarkelov / ttdl

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

How To: Remove Overdue When Running `stats` on the Archived Records #65

Closed MikeTheSapien closed 1 year ago

MikeTheSapien commented 1 year ago

When I run the binary with the inputs:

stats --todo-file [.txt for archive]

The binary also computes for the overdues, it's obviously because I'm misusing the app. But when I would then run

stats --todo-file [.txt for archive] --done

The following error is printed:

Invalid command: when using done.txt the only available command is `list`

The reason for running stats on the file that contains archives is that I'm curious which project and context I mostly allocated my time into.

My question would be, should I create an .ps1 for Windows, or .sh, as a plugin for custom formatting?

VladimirMarkelov commented 1 year ago

I agree, running stats against done.txt makes sense. I'll check it and fix.

My question would be, should I create an .ps1 for Windows, or .sh, as a plugin for custom formatting?

It looks like a very different question unrelated to the issue title. Are you talking about custom formatting with ! commands? In this case, it defaults to cmd.exe on Windows and sh on other OSes. You can set any shell for your formatters by changing TTDL config: see section [global], option shell = in ttdl.toml

MikeTheSapien commented 1 year ago

I agree, running stats against done.txt makes sense. I'll check it and fix.

I don't want to impose, you don't have to! I can make it for you with your instructions. It's my concern.


Regarding my question with the creation of .ps1 file of .sh, I thought I should just customize the output of stats for tasks that are archived and just remove the Overdue column in STDOUT. But then, as I write this down, I think the actual and real tasks done in a date later than its due date (overdue) won't be printed in the stats and that might provide insight on the user.

VladimirMarkelov commented 1 year ago

I don't want to impose, you don't have to! I can make it for you with your instructions. It's my concern.

it was very tiny fix. One-two lines changed. I've just done it :) But as I have found a few more issues with the command stats, the commit has got kind of big. A big issue was that the number of overdue todos in short stats and in full stats were different.

... and just remove the Overdue column in STDOUT ...

By the way, it was one of things I fixed in my latest commit. Now the number of overdue todos calculation has changed. For completed todos, a todo that has finish date earlier or equal to due date is not overdue any longer. It should make stats for done.txt more correct

VladimirMarkelov commented 1 year ago

Regarding my question with the creation of .ps1 file of .sh, I thought I should just customize the output of stats

I am sorry, I misunderstood your question. It looks like my thoughts were only about the trouble of running stats for done.txt. With the latest commit, it is possible that the number of overdue todos in the statistics for done.txt drops to 0. So, it would be a useless column but a harmless one. If you want to eliminate the column (and the line in short stats) from the output, it makes sense to write a wrapper - a shell script. I think for TTDL it makes no different what you use: sh or psh - it depends only on what shell you use and what shell language you know well. You are free to use any shell language. Theoretically you even can write a wrapper in Rust :) Though, it can be overkill.