3 ms·
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 cr
by lc5G 6y ago
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?
- clpwn 6y agoYep!
- ninkendo 6y agoYeah it looks like they wanted to know how long each crate took to build individually. 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!
- OJFord 6y agoAlternatively: Don't be that person who clones the repo at a path with spaces in!
- ninkendo 6y agoNot having spaces in your directory names is certainly a good idea, but I'll be damned if I let any of my code have issues with them. Just because something's a good idea doesn't mean it should be a requirement :) (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!)