Last active
April 22, 2024 04:53
-
-
Save singularitti/9c2307690441bb30108ab3902aa2834a to your computer and use it in GitHub Desktop.
Homebrew snippets
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
using IOCapture | |
export livecheck, bump_cask_pr | |
function livecheck(cask) | |
try | |
c = IOCapture.capture() do | |
run(`brew livecheck --cask $cask`) | |
end | |
str = c.output | |
regex = Regex(cask * ":[ ]+([^=]+)[ ]+==>[ ]+([^\n]+)") | |
m = match(regex, str) | |
if !isnothing(m) | |
old, new = m.captures | |
if new >= old | |
return new | |
end | |
end | |
catch e | |
print(e) | |
return nothing | |
end | |
end | |
function bump_cask_pr(cask) | |
version = livecheck(cask) | |
if !isnothing(version) | |
try | |
run(`brew bump-cask-pr $cask --no-browse --write-only --commit --version $version`) | |
catch e | |
print(e) | |
return nothing | |
end | |
end | |
end |
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
#!/bin/bash | |
brew alias au='audit --new --online' | |
brew alias arm='autoremove' | |
brew alias b='bundle' | |
brew alias bd='bundle dump' | |
brew alias ug='upgrade' | |
brew alias dt='deps --tree' | |
brew alias i='install' | |
brew alias if='info' | |
brew alias e='edit' | |
brew alias h='home' | |
brew alias ri='reinstall' | |
brew alias l='list --formula' | |
brew alias le='leaves' | |
brew alias o='outdated' | |
brew alias s='search' | |
brew alias sf='style --fix' | |
brew alias c='cleanup --prune=all -s' | |
brew alias use='uses --recursive --installed' # From https://zanshin.net/2014/02/03/how-to-list-brew-dependencies/ | |
brew alias fpr='bump-formula-pr --no-browse --version' | |
brew alias z='uninstall --force --zap' | |
# From https://zanshin.net/2014/02/03/how-to-list-brew-dependencies/ | |
brew list --formula | while read cask; do | |
echo -n "\e[1;34m$cask ->\e[0m" | |
brew deps $cask | awk '{printf(" %s ", $0)}' | |
echo "" | |
done | |
brew alias ci='install --cask' | |
brew alias cl='list --cask' | |
brew alias cx='uninstall --cask' | |
brew alias cz='uninstall --zap --force --cask' | |
brew alias cif='info --cask' | |
brew alias cpr='!julia -e "include(expanduser(\"~/.brew.jl\")); bump_cask_pr(ARGS[1])"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment