Closed majian4work closed 1 year ago
Hi @Ma-Jian1 -
So far rust-parallel does not support the :::
syntax you showed.
This is supported by GNU Parallel.
May I ask what is your use-case is for this? What cli
application do you run with this?
There are 2 ways to do a similar thing now with rust-parallel - see more details below.
Thanks for your question!
Working solutions in rust-parallel v1.0.0:
$ cat >./input <<EOL
cli arg1
cli arg2
cli arg3
EOL
$ cat ./input | rust-parallel
cli
command as a command line argument:
$ cat >./input <<EOL
arg1
arg2
arg3
EOL
$ cat ./input | rust-parallel cli
I want to install a bunch of rust cli tools, such as just, erdtree, starship, bottom
etc
cargo install --locked just, erdtree, starship ...
seems don't run in parallel, so it's too slow.
gun parallel will spawn a sub-process for every target which is fast. but maybe not safe (maybe locked)
HERE Doc may be workable, but it's a little cumbersome.
Will work on adding support for :::
option to spawn commands from command line arguments.
Seems like Itertools::multi_cartesian_product
is a good fit for getting all combinations of command line arguments if there are multiple :::
options.
parallel echo ::: A B ::: C D E ::: F G
Thanks!
Working on this in a branch: https://github.com/aaronriekenberg/rust-parallel/tree/input_channel
Things are beginning to work in this branch but not ready for release just yet. Getting close 😄
Compare this:
rust-parallel -c echo ::: A B ::: B C ::: D E F
With gnu parallel:
parallel echo ::: A B ::: B C ::: D E F
Version 1.1.0 released today has this change: https://github.com/aaronriekenberg/rust-parallel/releases/tag/v1.1.0
See these demos for examples: https://github.com/aaronriekenberg/rust-parallel#commands-from-arguments-mode https://github.com/aaronriekenberg/rust-parallel#commands-from-arguments-mode-bash-function
Thanks!
does this expand to