mbornet-hl / hl

Highlight (colorize) text data using regular expressions (efficient C program)
Other
118 stars 9 forks source link

Comparison with supercat? #13

Closed dufferzafar closed 5 years ago

dufferzafar commented 6 years ago

Hi, I use supercat for doing the highlighting: http://supercat.nosredna.net/

It is also written in C (& uses regcomp) etc.

Have you compared your tool against it, and if so, what are the benefits? (if any)

Knowing this will be helpful for people (who don't know much C) but want to decide which tool to use.

Thanks!

mbornet-hl commented 6 years ago

Hi,

thank you for your mail. I didn't know "supercat". I've just had a quick look on it and I already see some differences :

I greatly appreciate the fact that the authors created a man page, and included some examples : that's also part of the Unix philosophy, and I thank them a lot for that !

Now, regarding what command the users will use if they have to use only one of these two commands (but why would they have to ???), I can't give you an answer : users must try both commands and they will then use the one that suits their needs, or the one they prefer. There will probably be two different populations of users depending on their needs and on their feeling with the command line interface of the commands.

Regards.

Martial Bornet

On 07/12/2018 09:55 AM, Shadab Zafar wrote:

Hi, I use supercat for doing the highlighting: http://supercat.nosredna.net/

It is also written in C (& uses regcomp) etc.

Have you compared your tool against it, and if so, what are the benefits (if any)

Knowing this will be helpful for people (who don't know much C) but want to decide which tool to use.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mbornet-hl/hl/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/ALAHLXa87MHPdFoAQcXqsGN2dDF_PIOcks5uFwDegaJpZM4VMX8_.

dufferzafar commented 6 years ago

Thanks a lot for the detailed reply @mbornet-hl

hl does seem to have a lot of features that I want, so I'll soon be porting my supercat config files here!

hl may be used to transparently colorize commands' output

How can this be configured exactly?

hl is able to colorize text between two markers specified with regexp

Yeah, I was actually trying hard to get something like this to work with supercat.


As far as using the tools is concerned - I ,for one, like to stick with one tool. But yeah, other users are free to use whichever they want (or even both.) but this comparison will be of help to everyone!

mbornet-hl commented 5 years ago

Hello, sorry for the late answer. I described the "hl" command in the french magazine "Linux Pratique" number 093 : https://connect.ed-diamond.com/Linux-Pratique/LP-093/Colorisez-vos-textes-avec-la-commande-hl and you can find how to transparently colorize commands in paragraph 14 : Colorisation facile de commandes choisies (script hl_generic). In simple words,if you want to colorize a command, say "vmstat" for example, you just have to define an "hl" configuration named "vmstat" in $HOME/.hl.cfg, create a hard link named "vmstat" to $HOME/hl_bin/hl_generic, make sure $HOME/hl_bin comes before the directory containing "vmstat" in your PATH variable, and eventually run "hash -d vmstat". That's it. Further calls of "vmstat" should first call $HOME/hl_bin/hl_generic which will call "vmstat" and colorize it. If you create interesting colorization configurations for Linux commands, I may integrate them in the /etc/default/hl configuration file. Have fun !