Re:Greppability is an underrated code metric
by ddfs123 on Monday September 02, 2024 @11:56PM
(#41431102)
Unless you have syntax-aware grep support, I don't see how searching nested key json could be better. But grep is the default installed. Not to mention ad-hoc languages that does not have any IDE support.
[ Parent
| on HN ]
Re:Greppability is an underrated code metric
by abc-1 on Tuesday September 03, 2024 @12:05AM
(#41431150)
If you put a lot of arbitrary constraints to not allow it to be better, sure. Enjoy.
Re:Greppability is an underrated code metric
by medstrom on Tuesday September 03, 2024 @07:13AM
(#41433661)
There is no conflict between improving tools and learning how to express your code in such a way that as many tools as possible work better OOTB.
Re:Greppability is an underrated code metric
by uasi on Tuesday September 03, 2024 @12:18AM
(#41431219)
gron makes nested JSON greppable https://github.com/tomnomnom/gron
Re:Greppability is an underrated code metric
by hoherd on Tuesday September 03, 2024 @08:35AM
(#41434358)
`gron` is so underrated. Usually when I try to show people who useful it is they don't seem to understand how powerful it is. One common use is showing how to customize only one part of a helm chart by checking values of an already installed chart:
$ helm get values -n $NS $DEPLOYMENT -o json | gron | grep resources | gron -u | json-to-yaml.py
elasticsearch:
client:
resources:
limits:
cpu: 3
memory: 4Gi
requests:
cpu: 1
memory: 2Gi
data:
resources:
limits:
cpu: 6
memory: 6Gi
requests:
cpu: 200m
memory: 2Gi
fluentd:
resources:
limits:
memory: 768Mi
requests:
memory: 384Mi
That snip could be provided to another team or a customer as a yaml file that could be included with `helm upgrade -f whatever.yaml`. This is soooo much easier than digging that limited set of data out of the much more detailed data.