Last active
December 23, 2021 03:23
-
-
Save luckman212/b313dae6cbc9e8d46171c3f44fe9ea27 to your computer and use it in GitHub Desktop.
Find recently updated Homebrew formulae
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
| #!/usr/bin/env bash | |
| # https://apple.stackexchange.com/questions/304345/show-installation-date-of-packages-installed-with-homebrew/432218#432218 | |
| # https://apple.stackexchange.com/questions/373442/how-to-generate-list-of-homebrew-formulas-packages-sorted-by-most-recently-upda/ | |
| #default timeframe | |
| tf=1d | |
| case $1 in | |
| -h|--help) echo "usage: ${0##*/} [time] e.g. 90m, 1h, 3d (default: $tf)"; exit;; | |
| '') echo 1>&2 "% using $tf";; | |
| *) tf=$1 | |
| esac | |
| repo=$(brew --repository) | |
| if [ -z $repo ]; then | |
| echo 1>&2 "% could not determine brew directories" | |
| exit 1 | |
| fi | |
| find "$repo/Library/Taps/homebrew/homebrew-core/Formula" \ | |
| -type f \ | |
| -name '*.rb' \ | |
| -mtime -$tf | | |
| awk 'BEGIN { | |
| SQ="\047"; | |
| DQ="\042"; | |
| BOLD="\033[1m"; | |
| NORM="\033[0m"; | |
| } | |
| { | |
| c=sprintf("basename %s",$0); | |
| c | getline f; | |
| close(c); | |
| sub(".rb$","",f); | |
| c=sprintf("sed -En %ss/^ +desc %s(.*)%s/\\1/p%s %s",SQ,DQ,DQ,SQ,$0); | |
| c | getline d; | |
| close(c); | |
| printf("%s%s:%s %s\n",BOLD,f,NORM,d); | |
| }' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
N.B. revision <3 of this script had a bug, please use v3 or higher.