Created
March 5, 2018 11:45
-
-
Save yitsushi/c06f7e772086f0fe2b9f411264d9848c to your computer and use it in GitHub Desktop.
homebrew-news is a simple shell script to list changes in Formulas, for example spotting new apps, renamed or deleted Formulas.
This file contains hidden or 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
#!/bin/bash | |
days=${1:-1} | |
current_dir=$(pwd) | |
homebrew_prefix=$(brew --prefix) | |
for formula_dir in $(find ${homebrew_prefix}/Homebrew/Library/Taps -name "Formula" -type d); do | |
cd $formula_dir | |
formulas=$(git log --pretty=format: --name-status --since="${days} days ago" | sort | uniq | sed -e "s#Formula/##g;s# #___#g") | |
for formula in ${formulas}; do | |
state=${formula:0:1} | |
formula=${formula#*___} | |
content="${formula_dir}/${formula}" | |
name=$(echo $formula | sed -e 's/\.rb//g') | |
if [ ! -f "${content}" ]; then | |
printf "[%s] %-30s\n" "${state}" "$(sed -e 's/___/ -> /g' <<< ${name})" | |
continue | |
fi | |
desc=$(cat "${content}" | grep "desc " | sed -Ee 's/.*desc "(.*)"/\1/g') | |
printf "[%s] %-30s%s\n" "${state}" "${name}" "${desc}" | |
done | |
done | sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output: