Interactive digger
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
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 Are there any news on this topic here?
Nope) Currently busy with my other open source projects. 😀 Some donations for this project can boost my interest in switching focus on fx. 😁
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
Done! . is dig now!
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.
Oh yes, that was one of my questions as well while trying out the new digging feature @antonmedv
The popup is no longer needed; start typing and fx will fuzzy search the fields.
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
Then typing lorem for example fuzzy matches across the whole JSON document, both keys and values:
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.