klogg icon indicating copy to clipboard operation
klogg copied to clipboard

Allow to use a file with filter patterns

Open variar opened this issue 4 years ago • 2 comments

predefined filters is a cool feature! I think the simple version of this is the -f option of grep, which can specify patterns in text files. And i think it's would be better if klogg can also support use a file as predefined filter. Using files as predefined filter could split user data from klogg configuration and compatible with the workflow of grep like tools. Single file is also easy to share.

I know it's quite same with the import/export feature by klogg conf file. But the simple file format of grep can be more general and compatible with different workflow, without depend klogg, and klogg own conf file is suite to support more complex options like specify if case sensitive for every pattern.

Originally posted by @xaljer in https://github.com/variar/klogg/issues/243#issuecomment-791874735

variar avatar Jun 10 '21 13:06 variar

Hi xaljer , your idea seems interesting, it would also fit my workflow, but I want to make sure we understand it the same way.

How I would see such feature is to add an option to specify directory in which there is a number of files, each file specifies one filter, where name of the file is filter name, and content is filter content.

In terms of practical implementation, I think it would be best to implement something similar to Highlighters sets - so you can specify multiple sets of filters, e.g. one set of filters per project you are working on, and for every set you can either add filters manually or specify directory with grep-like pattern files.

Let's wait for variar opinion, but I like it very much, and would be eager to help with implementation.

Originally posted by @twardakm in https://github.com/variar/klogg/issues/243#issuecomment-792038270

variar avatar Jun 10 '21 13:06 variar

Hi twardakm , yes, we got the same idea here. But I think we can talk more about details.

I think may be we can simplify concepts. We could just say "filter". A filter can be specified by inputting a regex in klogg manually, or specified by a file (could be in any directory).

“specify directory", you said, I think we can understand it as multi-selection of files under a directory, but there is no limitation that files under different directories. And sorry I am not quit understand you said about "sets of filters". I think klogg could just show predefined filters like currently, and user select one or more of them. If one project use two files, just pick those two filters. I am just worry about group filters may make UI complex.

Originally posted by @xaljer in https://github.com/variar/klogg/issues/243#issuecomment-792245924

variar avatar Jun 10 '21 13:06 variar