gargs icon indicating copy to clipboard operation
gargs copied to clipboard

Provide a way to escape the placeholder(s)

Open chocolateboy opened this issue 8 years ago • 2 comments

How would one run a command that includes {} or {1}? e.g.:

cat filenames.txt | gargs "find . -type f -name '{}' -exec rm {} \;"

where the first {} should be interpolated and the second should not?

xargs allows the substitution token to be customized with the -I option, as does GNU parallel. The latest version of map allows its substitution token (%) to be escaped in the same way as sprintf (%%).

Currently, gargs doesn't provide a way to do this for {}, or for {1}, {2} etc. I haven't run into this yet with gargs, but I've run into it in the past with xargs (and with map).

chocolateboy avatar Sep 02 '17 01:09 chocolateboy

thanks for the interest. For now, gargs sacrifices some functionality of ease-of-use and implementation.

I agree that most of these would be useful, but I haven't had a need for them and so I likely won't implement--again for the sake of ease-of-use.

@shenwei356 has a very nice implementation of a command processor that has a lot more functionality and might be more what you are looking for https://github.com/shenwei356/rush

brentp avatar Sep 02 '17 01:09 brentp

gargs + jq would be a powerful toolset to process json but the {} is killing it at the moment.

mterron avatar Dec 08 '19 21:12 mterron