Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

but the structure generator and decoder would be so closely coupled they might as well be the same program.

Alternatively, you could have grep take a list of colors from a config file or environment variable and blindly interpolate those strings to make colored output[1]. This also allows color to show up automatically for interactive use.

[1] this is in fact how grep works.



That's not all one might want to do the structured out.

Think of converting to HTML, as one example.


ripgrep does have a JSON output mode, if you're curious.

Of course, ripgrep handles coloring like GNU grep does.


lsusb | grep --color=always Linux | aha > grepped.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: