Live data from Hacker News

Show HN: Grep with colours written in Go

github.com

41–50 of 90 posts

Re: Show HN: Grep with colours written in Go

#42
post #4

Is this speed competitive with tools like the silver searcher (`ag`) or is the focus here on color?

As much as I love `ag`, I feel like ripgrep (https://github.com/BurntSushi/ripgrep) deserves mentioning when it comes to speed. If you haven't tried it, do it sooner rather than later.

Here's an excellent write-up on how it works, benchmarks, etc.: https://blog.burntsushi.net/ripgrep/

Re: Show HN: Grep with colours written in Go

#46
post #8
post #4

Is this speed competitive with tools like the silver searcher (`ag`) or is the focus here on color?

A quick look at the source shows that it appears to be linear and just uses `strings.Contains` or `r.MatchString` on each line, so I don't think it has any of the optimizations that are built into `ag`.

That is correct. The project is at its early stages. I want to see what the community need the most and shape the project towards that goal. On the other hand I tried to avoid optimisations until most of functionalities are implemented.

Re: Show HN: Grep with colours written in Go

#48
post #3

Nice job! Language-specific coloring is really nice! I'll give it a try. I normally use a different Golang tool called sift as my grep replacement (which I love so far): https://github.com/svent/sift Sift's goals seem to be mostly performance (it is super fast), but it would be nice to have some of these more sophisticated coloring features in there as well, as they are useful.

Cheers mate!

Re: Show HN: Grep with colours written in Go

#49
post #4

Is this speed competitive with tools like the silver searcher (`ag`) or is the focus here on color?

As much as I love `ag`, I feel like ripgrep ( https://github.com/BurntSushi/ripgrep ) deserves mentioning when it comes to speed. If you haven't tried it, do it sooner rather than later. Here's an excellent write-up on how it works, benchmarks, etc.: https://blog.burntsushi.net/ripgrep/

ripgrep is soooooo good. I have switched to it and will never look back.

Re: Show HN: Grep with colours written in Go

#50
post #26
post #22

Earlier quoted context omitted.

I don't understand why this is a standard. First: It requires that every command line tool add support for this environment variable. It may not be much effort for each project, but it adds up to a ton of developer time. Even if this standard gains traction, some apps will slip through the cracks. So in the success case, many users will still be annoyed that one or two of their tools print colors when they shouldn't.…

What if someone needs colors, but not colors that util maker used? What if two or more tools make different use of colors? With terminal aware of that problem you can remap or erase specific colors, but maybe it’s wiser to not create a problem at all, since just making text bold may be enough for practical needs. Edit: missing not

Sounds like a better standard is being able to define color schemas for CLI utilities. Would be pretty awesome if this were possible, though many utilities vary in what type of output is colored a certain way sadly.

Another workaround is to merely pipe the output to a file in certain cases.

Post reply on HN