Fzf: Is it possible to override the filter function? (combine with jq)

Created on 2 Jul 2018  ·  5Comments  ·  Source: junegunn/fzf

This is just a question. If not possible you can ignore it.

So I like fzf live filtering. I found out that a tool like jq exist to filter json.

Eg. I have this json file foo.json:

{
  "swagger": "2.0",
  "schemes": [
    "http"
  ],
  "host": "todos.stoplight.io",
  "info": {
    "version": "1.0",
    "title": "To-do Demo"
  }
}

I can do the filtering like this:

❯ cat todos.json| jq .swagger
"2.0"

❯ cat todos.json| jq .info.title
"To-do Demo"

Unfortunately this is not live filtering like fzf. Is it possible to pass this filter to fzf? Something like:

❯ cat todos.json| fzf --filter "jq"

Thanks!

question

All 5 comments

There exists a specialized tool to do something like you want to do jid.

Hope it helps.

It's not possible.

Thanks @edubxb!

In my experience, in the software world for every question beginning with "Is it possible.." the answer is yes. It is a matter of putting the effort.

What you want has been implemented recently
https://asciinema.org/a/A85oze0ZVRnglMGAF5vKopk6p

@mardukbp @grundic

Doesn't seem to work:

res=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/alpine/tags/?page=1")
./fzrepl -c 'jq -C {q}' -q . <<< $res
Was this page helpful?
0 / 5 - 0 ratings