Skip to content

Commit 4a5b026

Browse files
committed
[Linux] Don't prompt users to brew cask install
- I tried to install `keybase`, thinking I'd get the CLI. On Linux, casks don't work, yet I was still prompted to `brew cask install keybase`. When I tried that (just to make sure), I got the "casks are only supported on MacOS" error. - This change makes it so we don't prompt people to install casks if they're on platforms other than MacOS. Before: ``` ╭─issyl0@grus /home/linuxbrew/.linuxbrew/Homebrew ‹master› ╰─ $ brew install keybase Error: No available formula with the name "keybase" Found a cask named "keybase" instead. ``` After: ``` Error: No available formula with the name "keybase" ==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run: git -C "$(brew --repo homebrew/core)" fetch --unshallow Error: No previously deleted formula found. ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... ==> Searching taps on GitHub... Error: No formulae found in taps. ```
1 parent 50138db commit 4a5b026

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Library/Homebrew/extend/os/mac/missing_formula.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ def blacklisted_reason(name)
1313
generic_blacklisted_reason(name)
1414
end
1515
end
16+
17+
def cask_reason(name, silent: false, show_info: false)
18+
return if silent
19+
20+
cask = Cask::CaskLoader.load(name)
21+
reason = +"Found a cask named \"#{name}\" instead.\n"
22+
reason << Cask::Cmd::Info.get_info(cask) if show_info
23+
reason.freeze
24+
rescue Cask::CaskUnavailableError
25+
nil
26+
end
1627
end
1728
end
1829
end

Library/Homebrew/missing_formula.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,7 @@ def deleted_reason(name, silent: false)
196196
end
197197
end
198198

199-
def cask_reason(name, silent: false, show_info: false)
200-
return if silent
201-
202-
cask = Cask::CaskLoader.load(name)
203-
reason = +"Found a cask named \"#{name}\" instead.\n"
204-
reason << Cask::Cmd::Info.get_info(cask) if show_info
205-
reason.freeze
206-
rescue Cask::CaskUnavailableError
207-
nil
208-
end
199+
def cask_reason(name, silent: false, show_info: false); end
209200

210201
require "extend/os/missing_formula"
211202
end

0 commit comments

Comments
 (0)