for crate in $(ls */Cargo.toml | xargs dirname); do
cargo build
Why do this instead of cargo --workspace build
Is it so you can time the individual crates? for crate in $(ls */Cargo.toml | xargs dirname); do
cargo build
Why do this instead of cargo --workspace build
Is it so you can time the individual crates?But as long as we're nitpicking, nobody should just pipe `ls` into `xargs` like this, since it fails if anything has spaces in it.
Instead, do:
for cargo_toml in */Cargo.toml; do
crate="$(dirname "${cargo_toml}")"
pushd $crate
# ...
done
Don't be that person who writes a script which won't tolerate spaces in filenames!(The main reason for the advice of "Don't put spaces in paths" is really only because it breaks lots of poorly-written software... but that's not an excuse for your software to be poorly-written!)