mirror of
https://github.com/nushell/nushell.git
synced 2024-11-08 09:34:30 +01:00
7b89fab327
# Description This PR adds new flag `--keep-order/-k` for the `par_each` filter. This flag keeps sequence of output same as the order of input. Output without the flag: ```nu > 1..6 | par-each {|n| $n * 2 } ╭────╮ │ 4 │ │ 10 │ │ 2 │ │ 8 │ │ 12 │ │ 6 │ ╰────╯ ``` Output with the `--keep-order` flag: ```nu > 1..6 | par-each --keep-order {|n| $n * 2 } ╭────╮ │ 2 │ │ 4 │ │ 6 │ │ 8 │ │ 10 │ │ 12 │ ╰────╯ ``` I think the presence of this flag is justified, since: - Much easier to use than `.. | enumerate | par-each {|p| update item ..} | sort-by index | get item` - Faster, as it uses internally parallel sorting in the same thread pool A note about naming: it may conflict with `--keep-empty/-k` flag of the `each` filter if the same feature will be used in `par-each`, so maybe it needs some other name. |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml | ||
LICENSE |