ransome1 / sleek

todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)
https://github.com/ransome1/sleek/wiki
MIT License
1.39k stars 110 forks source link

Create done.txt for completed tasks #446

Closed durgaswaroop closed 1 year ago

durgaswaroop commented 1 year ago

Right now, when we hit Archive, the popup message says that a new file named done.txt will be created. But the actual file name ends up being todo_done.txt. Also, there is a bug with the existing file construction because of which the done file never gets created if filename matches any path of the folder structure. (Discussed in https://github.com/ransome1/sleek/issues/378).

This will resolve both by creating done.txt in the same folder.

ransome1 commented 1 year ago

@durgaswaroop thanks again.

But there's one thing that should be discussed, as we're changing an essential behavior with this. The reason for the NAMEOFTODOFILE_done.txt is to enable users to work in several todo.txt files, which can then be archived into separate done.txt files. I'm thinking about introducing an option that lets users choose how they want to have their todos archived. What's your take on this?

durgaswaroop commented 1 year ago

I thought the behavior was to have the done.txt file created but didn't realize it was supposed to be based on the file name itself which is why I had updated the name in this PR. My bad!

I have always only had one todo.txt file, but I can certainly see the merit of using the name of the todo file in the done file.

When you say you are introducing an option for users to choose, how would that work? Would they just give a generic pattern for how the done file should be named? Would it be something like <NAMEOFTODOFILE>_done.txt or <NAMEOFTODOFILE>.done etc.. as config they can provide?

ransome1 commented 1 year ago

When you say you are introducing an option for users to choose, how would that work? Would they just give a generic pattern for how the done file should be named? Would it be something like <NAMEOFTODOFILE>_done.txt or <NAMEOFTODOFILE>.done etc.. as config they can provide?

Some users will ask for more than that, like naming their done files themselves, but this would add too much complexity to this. Not only just some JS, but also significant changes to the interface and such.

I think what we should do is what you're proposing in this paragraph. I can add an option that we could separateDoneFiles (can be accessed like userData.separateDoneFiles) and set it to false per default. Like that the done file's name will be done.txt, which I myself would prefer. And apparently is what users expect, with regards to your assumption above. Set to true will restore the old behaviour.

durgaswaroop commented 1 year ago

Yeah, that seems like a sensible middle ground between the two options.

durgaswaroop commented 1 year ago

@ransome1, What should be the next step here? Will you be adding this, or shall I give it a try to add this?

ransome1 commented 1 year ago

@durgaswaroop my apologies for responding so late!

You can simply go ahead and add this setting. You would want to do this here: https://github.com/ransome1/sleek/blob/master/src/main.js#L358

Simply add a new default setting: if(typeof userData.data.separateDoneFiles != "boolean") userData.data.separateDoneFiles = false;

In the main process you can access it under userData.data.separateDoneFiles and in the renderer process the setting will be available under userData.separateDoneFiles.

ransome1 commented 1 year ago

Since I'm currently rewriting sleek, I'm afraid I won't be merging this pull request for obvious reasons. But I want to express my gratitude again for your efforts.