|
|
|
|
|
by shric
2218 days ago
|
|
I really wish more CLIs would have a, ideally standard, flag to output something structured and easily parsable. One of the biggest arguments for CLIs is their composability, which is true for canonical examples like | sort | uniq -c | sort -nr | head -10 etc. However, I find myself constantly having to use awk, sed, cut, etc. far too often. A very much inexhaustive list of things one has to deal with: - whitespace delimited with fields that contain whitespace. - tabular lined up data that doesn't actually use tabs, and when a field is too wide, it just pushes the rest of the line over. - 5,000 different variants of CSV Of course some things (e.g. kubectl) have json and yaml output options, which can be nicely parsed with jq. I also found https://github.com/kellyjonbrazil/jc handy, which attempts to convert many commands to json output. |
|