Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Created March 5, 2018 11:45
Show Gist options
  • Save yitsushi/c06f7e772086f0fe2b9f411264d9848c to your computer and use it in GitHub Desktop.
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.
#!/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
@yitsushi
Copy link
Author

yitsushi commented Mar 5, 2018

homebrew-news <number of days : default=1>

Sample output:

~
❯ homebrew-news
[M] burp                          Network backup and restore
[M] calabash                      XProc (XML Pipeline Language) implementation
[M] fuse-emulator                 Free Unix Spectrum Emulator
[M] gomplate                      Command-line Golang template processor
[M] gsoap                         SOAP stub and skeleton compiler for C and C++
[M] imagemagick                   Tools and libraries to manipulate images in many formats
[M] imagemagick@6                 Tools and libraries to manipulate images in many formats
[M] jemalloc                      malloc implementation emphasizing fragmentation avoidance
[M] log4cplus                     Logging Framework for C++
[M] meson                         Fast and user friendly build system
[M] mongo-cxx-driver              C++ driver for MongoDB
[M] mutt                          Mongrel of mail user agents (part elm, pine, mush, mh, etc.)
[M] nco                           Command-line operators for netCDF and HDF files
[M] ocrmypdf                      Adds an OCR text layer to scanned PDF files
[M] offlineimap                   Synchronizes emails between two repositories
[M] poppler                       PDF rendering library (based on the xpdf-3.0 code base)
[M] pre-commit                    Framework for managing multi-language pre-commit hooks
[M] pyqt                          Python bindings for v5 of Qt
[M] qscintilla2                   Port to Qt of the Scintilla editing component
[M] sbcl                          Steel Bank Common Lisp system
[M] sip                           Tool to create Python bindings for C and C++ libraries
[M] twarc                         Command-line tool and Python library for archiving Twitter JSON
[M] vnstat                        Console-based network traffic monitor
[M] wireguard-tools               Tools for the WireGuard secure network tunnel

~
❯ homebrew-news 2
// more longer list XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment