Created
June 26, 2019 02:12
-
-
Save ampersanda/6b2e0ef0a395741e3a6f2c4c311a9419 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Utility to suggest a new package to try from Homebrew | |
# Simply run and it will give you a new package to try out | |
files=(/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/*) | |
total=${#files[@]} | |
rando=$((RANDOM % total)) | |
package=$(basename "${files[rando]}" .rb) | |
printf "\\nTry out a random homebrew package!\\n\\n" | |
brew info "${package}" | |
if [[ $(command -v pbcopy) ]] | |
then | |
echo "brew install ${package}" | pbcopy | |
printf "\\nCommand \"brew install %s\" copied to clipboard\\n" "$package" | |
else | |
printf "\\nUse \"brew install %s\" to try it out\\n" "$package" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment