fx icon indicating copy to clipboard operation
fx copied to clipboard

Interactive digger

Open ducaale opened this issue 3 years ago • 1 comments

In previous versions of fx, it was possible to write a reducer without leaving the interactive mode by pressing .. The closest workaround I can think of now is using fx twice, but that would still be missing the interactive part.

curl -s httpbin.org/json | fx .slideshow | fx

The demo.gif fx had before the golang-rewrite

ducaale avatar May 07 '22 17:05 ducaale

Yes, definitely. I’m working on it) but not sure about autocomplete, as in current tui lib, it isn’t supposed and I have to implement this myself.

But reducers in interactive mode will be added.

antonmedv avatar May 07 '22 20:05 antonmedv

@antonmedv Are there any news on this topic here?

111andre111 avatar Feb 20 '23 15:02 111andre111

Nope) Currently busy with my other open source projects. 😀 Some donations for this project can boost my interest in switching focus on fx. 😁

antonmedv avatar Feb 20 '23 15:02 antonmedv

how old is the non-golang version? Why was it rewritten? I can't support a golang project right now, but it's possible I could work on the JS version, assuming (hoping) that's what it was written in.

Absent that it might be nice to use the old version for the time being as interactive reducers are my use case

refactorized avatar Mar 10 '23 08:03 refactorized

Done! . is dig now!

antonmedv avatar Sep 19 '23 08:09 antonmedv

Congrats on the new 30.x release of fx @antonmedv, it looks great!

Question re the interactive digger - is it supposed to pop up a list of available fields? If I press . in interactive mode (eg fx some_file.json), the cursor appears at the bottom of the screen, but no list of fields.

I'm on the latest version:

❯ fx --version                                                                            
30.0.3

Thanks.

joehorsnell avatar Sep 21 '23 08:09 joehorsnell

Oh yes, that was one of my questions as well while trying out the new digging feature @antonmedv

111andre111 avatar Sep 21 '23 09:09 111andre111

The popup is no longer needed; start typing and fx will fuzzy search the fields.

antonmedv avatar Sep 21 '23 09:09 antonmedv

The popup is no longer needed; start typing and fx will fuzzy search the fields.

Thanks for the quick response @antonmedv.

Do you mean fuzzy search the fields at that level of nesting in the data? I think if the fuzzy search filtered what you saw to only show the matches, i.e. like fzf does (see below), then I'd agree with you. But I think it's very useful to get a summary list of the fields at that level of the data in a pop-up, especially if it's a very large JSON document.

Edit: For example, one simple approach to fuzzy-finding JSON is using gron and fzf (brew install fzf gron if not already installed):

❯ curl --silent https://raw.githubusercontent.com/antonmedv/fx/master/testdata/example.json | gron | fzf
image

Then typing lorem for example fuzzy matches across the whole JSON document, both keys and values:

image

joehorsnell avatar Sep 21 '23 09:09 joehorsnell

I tried a full fuzzy search in fx (with fuzzing of nested fields), but I found that this makes navigation much more unpredictable: the cursor jumps around as you type. So I tried to restrict fx to the first level.

antonmedv avatar Sep 21 '23 13:09 antonmedv