sleek icon indicating copy to clipboard operation
sleek copied to clipboard

Ignore lines that start with

Open gerroon opened this issue 1 year ago • 10 comments

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.

gerroon avatar Feb 10 '24 20:02 gerroon

@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 ...

ransome1 avatar Feb 10 '24 21:02 ransome1

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

gerroon avatar Feb 10 '24 22:02 gerroon

@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.

ransome1 avatar Feb 11 '24 16:02 ransome1

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.

gerroon avatar Feb 11 '24 18:02 gerroon

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.

ransome1 avatar Feb 11 '24 18:02 ransome1

Thanks, I think it works.

gerroon avatar Feb 11 '24 18:02 gerroon

Btw would it accept multiple prefix types?

gerroon avatar Feb 11 '24 21:02 gerroon

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.

ransome1 avatar Feb 12 '24 07:02 ransome1

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

gerroon avatar Feb 12 '24 16:02 gerroon

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

ransome1 avatar Feb 23 '24 20:02 ransome1