Skip to content

Instantly share code, notes, and snippets.

@stefanschmidt
Created October 21, 2022 10:48
Show Gist options
  • Save stefanschmidt/ff2b49a41af6deaa630c842207c0de90 to your computer and use it in GitHub Desktop.
Save stefanschmidt/ff2b49a41af6deaa630c842207c0de90 to your computer and use it in GitHub Desktop.
Show man page for keg-only Homebrew formulae
# 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