diff --git a/Source/BrewInfo.spoon/init.lua b/Source/BrewInfo.spoon/init.lua index c203d3c9..d61c27a6 100644 --- a/Source/BrewInfo.spoon/init.lua +++ b/Source/BrewInfo.spoon/init.lua @@ -22,6 +22,11 @@ mod.author = "Diego Zamboni " 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 @@ -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 .. "'!" @@ -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