ransome1 / sleek

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

Ignore lines that start with #660

Open gerroon opened 4 months ago

gerroon commented 4 months ago

What problem does it solve?

Hi

It would be useful if Sleek can ignore lines start with certain words/characters etc that can be defined in the settings. This can help with being able to add more information, commenting integration with other apps. For instance I want to be able to have yaml frontmatter at the top of the todo.txt file, currently that would look sucky in Sleek. But if the user can define a set of words/characters to ignore lines. words etc Sleek can just show the relevant todo info as usual

How does the user interface change to accommodate this request?

The interfcae would not chage, but the user would need a way to define ignore patterns in some kind of setting.

ransome1 commented 4 months ago

@gerroon since I don't consider this a self explanatory feature for the average sleek user, I would propose a setting on config file level. Something like excludeLineStartsWith: "//"

I cannot think of a good attribute name ...

gerroon commented 4 months ago

That would do it for real. Thanks for considering it.

ransome1 commented 4 months ago

@gerroon you can find this function in the latest pre-release: https://github.com/ransome1/sleek/releases/tag/v2.0.10-rc.1

In your config you will find a new setting called excludeLinesWithPrefix. Per default it is set to null and has no effect.

If you for instance add a string like this excludeLinesWithPrefix: "##", each line which starts with ##, should be skipped during the parsing process. Feel free to give it a try.

gerroon commented 4 months ago

Thanks, however I am not seeing that new setting in the config file. It did not look like it added it after I ran the updated version.

ransome1 commented 4 months ago

It's possible that the migration tool will only add it on non rc version. You can just add the option manually to the config.json.

gerroon commented 4 months ago

Thanks, I think it works.

gerroon commented 4 months ago

Btw would it accept multiple prefix types?

ransome1 commented 4 months ago

Right now it only accepts a single string, but it can be build in a way, that it would accept an array:

"excludeLinesWithPrefix": [
    "##",
    "//"
]

If this helps, I can change the behavior in the next pre-release.

gerroon commented 4 months ago

That would be awesome Thank you. Thanks for implementing it.

ransome1 commented 4 months ago

@gerroon the array approach can be tested in the latest pre-release: https://github.com/ransome1/sleek/releases/tag/v2.0.10-rc.2