interactively icon indicating copy to clipboard operation
interactively copied to clipboard

[feature] Can it support interactively jq -r {} syntax.json? not quotes.

Open Freed-Wu opened this issue 3 years ago • 3 comments

Thanks!

Freed-Wu avatar Nov 03 '22 13:11 Freed-Wu

I'm hesitant to support this since:

  1. {} means something in bash and I'm not entirely sure it'll always work as desired
    $ echo {1..2}
    1 2
    
  2. argument parsing may not work properly, and that type of code can be fragile in bash

I'm open to PRs, though so feel free to create one and we can discuss if the solution works.

bigH avatar Jun 28 '23 21:06 bigH

I'm hesitant, too. This is some related examples:

find . -name XXX -x rm {} -r \; and cat XXX.txt | xargs -I rm {}, parallel rm {} ::: XXX.txt's {} don't use quotes. fzf --preivew='less {}' use quotes.

Freed-Wu avatar Jun 30 '23 12:06 Freed-Wu

After thinking about this, I'm open to implementing this.

It's definitely true that {1..2} can easily just be quoted to avoid bash's expansion. It's also sort-of safe to have it expand incorrectly since interactively is not designed for side-effecting things.

I don't have the time to do this today, but it's pretty straight-forward. Create a PR and I'm happy to review.

bigH avatar Jun 30 '23 23:06 bigH