Open niedzielski opened 1 year ago
It would be good to split these out into two issues. Looping probably won't be implemented because if you are doing loops then you probably shouldn't be writing that in a task and instead use JavaScript for that (deno run ...
), but having feature parity with xargs
is desirable.
Thanks, I've made the split. Feel free to close the loop issue if it doesn't make sense--I opened it because I thought it was likely to come up again and it'd be nice to centralize that discussion.
@niedzielski thanks! I'll keep it open for now as a "suggestion" to see what other use cases come up.
Excuse me for interrupting.
I posted https://github.com/denoland/deno/discussions/25248 in the Discussions of the deno
repository (as I was unaware of the existence of this deno_task_shell
repository), but if this xargs -I
feature request is implemented in the future, could it be a solution to my problem?
» How do I insert the deno task
argument into the middle of that command?
The
xargs
command is super useful but is too constrained to use for invocations that depend on positional parameters. This feature request asks for the traditional -I/-i/--replace flags to be added.Eg:
Unfortunately,
-I
always constrains the maximum number of lines processed at a time to 1 and approximates the following loop:Although both looping and
xargs -I
provide similar functionality, I think they serve different uses. Simple loops are wanted for simple lists and xargs is wanted for pipes.Use case
In the absence of this support, task users are at the mercy of the subcommands they call. For example, here's how you would have to do copy with the current version of xargs:
However, many tools don't support non-positional arguments like the target parameter so this isn't an option. Even Deno's own cp command doesn't support
-t
so this also fails:References