.github/workflows/scripts/brew-uninstall-cascade.sh
raw| 1 | #!/bin/bash |
| 2 | |
| 3 | declare -a packages rdepends |
| 4 | packages=("$@") |
| 5 | |
| 6 | # have to try one by one, otherwise `brew uses` would only print |
| 7 | # packages that require them all rather than any of them |
| 8 | for package in "${packages[@]}"; do |
| 9 | rdepends+=($(brew uses --installed --include-build --include-test --include-optional --recursive "$package")) |
| 10 | done |
| 11 | brew uninstall "${packages[@]}" "${rdepends[@]}" |