Tuesday 4 April 2023

TIL: FuzzyFinder - fzf - and jq

Today I learned ( well, actually it was yesterday but who's counting days ? ) about fzf in the context of using it to test JQ expressions.

The revelation came from Julia Evans, author of WizardZines, aka b0rk, about whom I've written before.

She'd mentioned the use of fzf and jq in a post on Mastodon: -


so I had to try it out ...

Install fzf

brew install fzf

Create a JSON document

cat << EOF > the_simpsons.json
[
    {
        "givenName": "Maggie",
        "familyName": "Simpson"
    },
    {
        "givenName": "Lisa",
        "familyName": "Simpson"
    },
    {
        "givenName": "Marge",
        "familyName": "Simpson"
    },
    {
        "givenName": "Homer",
        "familyName": "Simpson"
    },
    {
        "givenName": "Bart",
        "familyName": "Simpson"
    }
]
EOF

Fire up fzf

echo '' | fzf --preview 'jq {q} < the_simpsons.json'

Tinker with various jq queries




Nice!

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...