cargo-updateall 368 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. if ! which cargo >/dev/null 2>&1; then
  3. echo "Error: cargo not found." >&2
  4. exit 1
  5. fi
  6. for pkg in $(cargo install --list | grep '^[^[:space:]]' | awk '{print $1}'); do
  7. printf '\nUpdating %s\n' "$pkg"
  8. locked=
  9. if [ "$pkg" = "bacon" -o \
  10. "$pkg" = "cargo-vet" ]; then
  11. locked="--locked"
  12. fi
  13. cargo install $locked "$@" "$pkg" || exit 1
  14. done
  15. exit 0