I am running some image transcoding tasks using taskfile and Nushell -- using Nconvert to transcode.
transcode-jpegxl:
#!nu
let read_img_files = { ls -f **/* | where type == file | get name}
do $read_img_files | enumerate | par-each {|it| nconvert -quiet -out jpegxl $it.item; print $' ... transcoded ($it.index)'; sleep 1ms; }
Note: sleep 1ms
was needed otherwise Nushell was buffering all the msgs and flushing them to stdout after all transcoding jobs finish.
It is taking hours and days to finish the transcoding jobs. So I want to be able to show some progress numbers (in case I need to abort). Nushell gives length
of the list and indices with enumerate
but how can I pipe the length of enumerated list and indices to run the transcoding job with par-each
or have some sort of inline progress-bar?