antonmedv / fx

Terminal JSON viewer & processor
https://fx.wtf
MIT License
19.08k stars 438 forks source link

Read Javascript processing instructions from file #172

Closed tomgallagher closed 3 years ago

tomgallagher commented 3 years ago

Hi

Is this possible, rather than using a string?

So I would like to do this:

head -n 10 data.json | fx -r -f instructions.js

Much like jq.

Thanks for your attention,

Tom

antonmedv commented 3 years ago

What about https://github.com/google/zx?

head -n 10 data.json |  zx file.js
tomgallagher commented 3 years ago

Thanks for the quick response!

Not sure I can see the similarities between fx and zx. I was hoping to be able to use fx to view after running js file.

tomgallagher commented 3 years ago

value=$(<core.js) && head -n 10 data.json | fx $value

That was what I was looking for, sorry, I'm not great at command line.