doronbehar / pistol

General purpose file previewer designed for Ranger, Lf to make scope.sh redundant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documenting the way of parsing the quotes

nacro90 opened this issue · comments

I have encountered some quoting issues. But I've noticed that they are features of
Go that may be documented.

For example I am using jq for previewing json files.
jq needs a query string with a quote like '' or '.' for the whole json.

jq '.' file.json

This is not working in pistol. When executed, jq gives an error:

jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Unix shell quoting issues?) at <top-level>, line 1:
'.'
jq: 1 compile error

jq says it got '.' instead of .. Go parser escapes the quotes. But in the
shell, quotes are consumed. So in pistol we should do:

application/json jq . %s

or with the upcoming sh: feature:

application/json sh: jq '.' %s

I think this should be documented to direct people to use sh: feature or
handle the quotes with this way.

Thank you for investigating that, all of your research results make sense and I think Pistol's behavior is good but it's not trivial so it's worth mentioning in the README . If you'd create a PR to close this issue I'd appreciate it, I still need to document what's in #13 .