bmatsuo / jqsh

An interactive wrapper to the jq command line utility
MIT License
23 stars 2 forks source link

jqsh fails if jq is a script #26

Open pkoppstein opened 9 years ago

pkoppstein commented 9 years ago

I normally have jq defined as a script that invokes /usr/local/bin/jq in a specific way, and so jqsh fails when it attempts to invoke jq, e.g.

$ jqsh -version=false
fork/exec /Users/user/bin/jq: exec format error

One way to allow jqsh to coexist with such a script would be to provide a command-line option specifying the pathname of the "jq" to be used.

Thank you.

bmatsuo commented 9 years ago

Yea. It makes sense to provide a way to override the executable in the PATH.

I will add an option, -jq.

jqsh -jq=/opt/bin/jq
>
pkoppstein commented 9 years ago

Thanks. Might I suggest --jq ...; it is customary to use -jq as a contraction of -j -q

bmatsuo commented 9 years ago

I'll think about it. I know most people would expect that...

I'm just using the Go stdlib for flag parsing at the moment. It doesn't have the notion as 'short options' and the contracted form.

I never looked for a good getopt package because I don't care much for short form options. To your example, -jq could also reasonably be interpreted as the flag -j with the value "q". It's application dependent.

pkoppstein commented 9 years ago

I am not advocating the compression of short options. Anyway, I think your point about "-jq" confirms the wisdom of not using "-jq X" to mean "--jq X". That is, the latter under most schemes only has the minor ambiguity as to whether or not X is an argument of the option.