jzelinskie / faq

Format Agnostic jQ -- process various formats with libjq
Apache License 2.0
440 stars 14 forks source link

Support reading jq program/filter from file #68

Closed chancez closed 5 years ago

chancez commented 5 years ago

jq has the following flag as an option:

       o   -f filename / --from-file filename:

           Read filter from the file rather than from a command line, like awk's -f option. You can also use '#' to make comments.

faq should have something similar.

jzelinskie commented 5 years ago

This conflicts with the existing -f flag which is for the input format, but I can understand the desire to add this functionality. A workaround could be using the party hat operator:

$ faq '.' <(cat myFile.json)
chancez commented 5 years ago

I'm an idiot, this does exist.

-F, --program-file string If specified, read the file provided as the jq program for faq.

I even added it. I just had an old cached build around.

jzelinskie commented 5 years ago

I wonder if we should swap the flags for compat, though.