docs » BrewInfo

Display pop-up with Homebrew Formula info, or open their URL

Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/BrewInfo.spoon.zip

You can bind keys to automatically display the output of brew info of the currently-selected package name, or to open its homepage. I use it to quickly explore new packages from the output of brew update.

API Overview

API Documentation

Variables

brew_info_delay_sec
Signature BrewInfo.brew_info_delay_sec
Type Variable
Description

An integer specifying how long the alerts generated by BrewInfo will stay onscreen

Source Source/BrewInfo.spoon/init.lua line 25
brew_info_style
Signature BrewInfo.brew_info_style
Type Variable
Description

A table in conformance with the hs.alert.defaultStyle format that specifies the style used by the alerts. Default value: { textFont = "Courier New", textSize = 14, radius = 10 }

Source Source/BrewInfo.spoon/init.lua line 30
select_text_if_needed
Signature BrewInfo.select_text_if_needed
Type Variable
Description

If true, and no text is currently selected in the terminal, issue a double-click to select the text below the cursor, and use that as the input to brew info. See also BrewInfo.select_text_modifiers. Defaults to true.

Source Source/BrewInfo.spoon/init.lua line 39
select_text_modifiers
Signature BrewInfo.select_text_modifiers
Type Variable
Description

Table containing the modifiers to be used together with a double-click when BrewInfo.select_text_if_needed is true. Defaults to {cmd = true, shift = true} to issue a Cmd-Shift-double-click, which will select a continuous non-space string in Terminal and iTerm2.

Source Source/BrewInfo.spoon/init.lua line 44

Methods

bindHotkeys
Signature BrewInfo:bindHotkeys(mapping)
Type Method
Description

Binds hotkeys for BrewInfo

Parameters
  • mapping - A table containing hotkey modifier/key details for the following items:
    • show_brew_info - Show output of brew info using the selected text as package name
    • open_brew_url - Open the homepage of the formula whose name is currently selected
    • show_brew_cask_info - Show output of brew cask info using the selected text as package name
    • open_brew_cask_url - Open the homepage of the Cask whose name is currently selected
Returns
Source Source/BrewInfo.spoon/init.lua line 161
openBrewURL
Signature BrewInfo:openBrewURL(pkg, subcommand)
Type Method
Description

Opens the homepage for package pkg, as obtained from the homepage field in brew <subcommand> cat <pkg>

Parameters
  • pkg - name of the package to query
  • subcommand - brew subcommand to use for the cat command. Defaults to an empty string, which results in "brew cat <pkg>" being run. For example, if subcommand is "cask", the brew cask cat <pkg> command will be used.
Returns
  • The Spoon object
Source Source/BrewInfo.spoon/init.lua line 121
openBrewURLCurSel
Signature BrewInfo:openBrewURLCurSel(subcommand)
Type Method
Description

Opens the homepage for the currently-selected package, as obtained from the homepage field in brew <subcommand> cat <pkg>

Parameters
  • subcommand - brew subcommand to use for the cat command. Defaults to an empty string, which results in "brew cat <pkg>" being run. For example, if subcommand is "cask", the brew cask cat <pkg> command will be used.
Returns
  • The Spoon object
Source Source/BrewInfo.spoon/init.lua line 148
showBrewInfo
Signature BrewInfo:showBrewInfo(pkg, subcommand)
Type Method
Description

Displays an alert with the output of brew <subcommand> info <pkg>

Parameters
  • pkg - name of the package to query
  • subcommand - brew subcommand to use for the info command. Defaults to an empty string, which results in "brew info <pkg>" being run. For example, if subcommand is "cask", the brew cask info <pkg> command will be used.
Returns
  • The Spoon object
Source Source/BrewInfo.spoon/init.lua line 84
showBrewInfoCurSel
Signature BrewInfo:showBrewInfoCurSel(subcommand)
Type Method
Description

Display brew <subcommand> info using the selected text as the package name

Parameters
  • subcommand - brew subcommand to use for the info command. Defaults to an empty string, which results in "brew info" being run. For example, if subcommand is "cask", the brew cask info command will be used.
Returns
  • The Spoon object
Source Source/BrewInfo.spoon/init.lua line 108