cgrep icon indicating copy to clipboard operation
cgrep copied to clipboard

Support for other languages (via config)

Open berdario opened this issue 9 years ago • 1 comments

Hi, I was trying to move from Ack to Cgrep, but I find a couple of feature of the former missing in the latter.

The most critical, would be the support for a few languages... this is my .ackrc:

--type-set=vala=.vala
--type-set=clojure=.clj,.cljs
--type-set=gsp=.gsp
--type-set=purs=.purs
--ignore-dir=.stack-work
--ignore-dir=.tox

But what I really need at the moment is just the support for Groovy and GSP templates (sigh...)

Since support for niche templating languages might be useful only to few, and due to the fact that adding the kitchen-sink might eventually lead to conflicts in langRevMap (which wouldn't be an error, but would be confusing)... I think that it might be in order to add some configuration to support custom extensions

I was about to look into how to add support for this, but I see that the configuration is a simple Read instance... I've never wrote a commandline Haskell application for which I needed configuration, so I'm not sure if this is really a good practice (I'd probably go with aeson-better-errors, even if I dislike JSON)...

So, I'm worried that adding (or changing) extra configurations might cause compatibility problems (cgrep might fail to start when loading old config files, for example). I'd like to know what do you think would be the preferred path, before working on a PR for this.

berdario avatar Sep 17 '16 15:09 berdario

Hi berdario,

I think we can add a better support for parsing a configuration file and that the Read instance we have is just because I'm too lazy for replacing it with a better thing. Personally I'd like to switch to YAML, but also JSON is fine to me.

If you want to contribute we don't even need to dismiss the old configuration file... We just need to add additional config which is parsed if available. Remember and unlike ack, you have also to specify the delimiters for literals and for comments...

We may even generalise the configuration for all the languages supported, so no need to update the cgrep is required in order to add additional languages.

Thanks for supporting cgrep.

Regards, N.

On Sat, Sep 17, 2016 at 5:46 PM berdario [email protected] wrote:

Hi, I was trying to move from Ack to Cgrep, but I find a couple of feature of the former missing in the latter.

The most critical, would be the support for a few languages... this is my .ackrc:

--type-set=vala=.vala --type-set=clojure=.clj,.cljs --type-set=gsp=.gsp --type-set=purs=.purs --ignore-dir=.stack-work --ignore-dir=.tox

But what I really need at the moment is just the support for Groovy and GSP templates (sigh...)

Since support for niche templating languages might be useful only to few, and due to the fact that adding the kitchen-sink might eventually lead to conflicts in langRevMap (which wouldn't be an error, but would be confusing)... I think that it might be in order to add some configuration to support custom extensions

I was about to look into how to add support for this, but I see that the configuration is a simple Read instance... I've never wrote a commandline Haskell application for which I needed configuration, so I'm not sure if this is really a good practice (I'd probably go with aeson-better-errors http://harry.garrood.me/blog/aeson-better-errors/, even if I dislike JSON)...

So, I'm worried that adding (or changing) extra configurations might cause compatibility problems (cgrep might fail to start when loading old config files, for example). I'd like to know what do you think would be the preferred path, before working on a PR for this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/awgn/cgrep/issues/37, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB6v-kV_Y68BAfrNZkJwSz0tV_6ubD-ks5qrAs-gaJpZM4J_oX7 .

awgn avatar Sep 19 '16 09:09 awgn