Created
October 21, 2022 10:48
-
-
Save stefanschmidt/ff2b49a41af6deaa630c842207c0de90 to your computer and use it in GitHub Desktop.
Show man page for keg-only Homebrew formulae
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
# show man page for keg-only Homebrew formulae (e.g. strings of binutils) | |
# usage: brewman name (name is the name of the manual page) | |
# example: brewman strings | |
# resolve symbolic link pointing to cellar of Homebrew formula | |
function cellar () | |
{ | |
formula_name=$1 | |
pushd /usr/local/opt >/dev/null | |
pushd $(readlink /usr/local/opt/$1) >/dev/null | |
pwd -P | |
popd >/dev/null | |
popd >/dev/null | |
} | |
# show man page for keg-only Homebrew formulae | |
function brewman () | |
{ | |
name=$1 | |
formula_name=$(brew which-formula $name) | |
cellar_path=$(cellar $formula_name) | |
man -M $cellar_path/share/man $name | |
} | |
export -f brewman |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment