Skip to content

Commit 546a91f

Browse files
committed
Add —language option.
1 parent b703c81 commit 546a91f

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Library/Homebrew/cask/lib/hbc/cli.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ def self.nice_listing(cask_list)
179179
def self.parser
180180
# If you modify these arguments, please update USAGE.md
181181
@parser ||= OptionParser.new do |opts|
182+
opts.on("--language STRING") do
183+
# handled in OS::Mac
184+
end
185+
182186
OPTIONS.each do |option, method|
183187
opts.on("#{option}" "PATH", Pathname) do |path|
184188
Hbc.public_send(method, path)

Library/Homebrew/os/mac.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,19 @@ def cat
4242
end
4343

4444
def languages
45-
@languages ||= if ENV["HOMEBREW_LANGUAGES"]
46-
ENV["HOMEBREW_LANGUAGES"].split(",")
47-
else
48-
Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/)
45+
return @languages unless @languages.nil?
46+
47+
@languages = Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/)
48+
49+
if ENV["HOMEBREW_LANGUAGES"]
50+
@languages = ENV["HOMEBREW_LANGUAGES"].split(",") + @languages
4951
end
52+
53+
if ARGV.value("language")
54+
@languages = ARGV.value("language").split(",") + @languages
55+
end
56+
57+
@languages = @languages.uniq
5058
end
5159

5260
def language

0 commit comments

Comments
 (0)