Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Source/BrewInfo.spoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ mod.author = "Diego Zamboni <diego@zzamboni.org>"
mod.homepage = "https://github.com/Hammerspoon/Spoons"
mod.license = "MIT - https://opensource.org/licenses/MIT"

--- BrewInfo.brew_path
--- Variable
--- A string specifying the path to the `brew` executable. Defaults to `/usr/local/bin/brew`
mod.brew_path = "/usr/local/bin/brew"

--- BrewInfo.brew_info_delay_sec
--- Variable
--- An integer specifying how long the alerts generated by BrewInfo will stay onscreen
Expand Down Expand Up @@ -95,7 +100,7 @@ function mod:showBrewInfo(pkg, subcommand)
local info = "No package selected"
local st = nil
if pkg and pkg ~= "" then
local cmd=string.format("/usr/local/bin/brew %s info %s", subcommand or "", pkg)
local cmd=string.format("%s %s info %s", self.brew_path, subcommand or "", pkg)
info, st=hs.execute(cmd)
if st == nil then
info = "No information found about formula '" .. pkg .. "'!"
Expand Down Expand Up @@ -131,7 +136,7 @@ end
function mod:openBrewURL(pkg, subcommand)
local msg = "No package selected"
if pkg and pkg ~= "" then
local j, st, t, rc=hs.execute(string.format("/usr/local/bin/brew %s cat %s",(subcommand or ""), pkg ))
local j, st, t, rc=hs.execute(string.format("%s %s cat %s", self.brew_path, (subcommand or ""), pkg ))
if st ~= nil then
local url=string.match(j, "\n%s*homepage%s+['\"](.-)['\"]%s*\n")
if url and url ~= "" then
Expand Down
Loading