From 546a91f78e67939e49df4984562f02b25e68aa72 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 25 Sep 2016 20:43:03 +0200 Subject: Add `—language` option. --- Library/Homebrew/cask/lib/hbc/cli.rb | 4 ++++ Library/Homebrew/os/mac.rb | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 3f67e131d..f637ae7af 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -179,6 +179,10 @@ module Hbc def self.parser # If you modify these arguments, please update USAGE.md @parser ||= OptionParser.new do |opts| + opts.on("--language STRING") do + # handled in OS::Mac + end + OPTIONS.each do |option, method| opts.on("#{option}" "PATH", Pathname) do |path| Hbc.public_send(method, path) diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 1b207a538..b2f0515a0 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -42,11 +42,19 @@ module OS end def languages - @languages ||= if ENV["HOMEBREW_LANGUAGES"] - ENV["HOMEBREW_LANGUAGES"].split(",") - else - Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/) + return @languages unless @languages.nil? + + @languages = Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").scan(/[^ \n"(),]+/) + + if ENV["HOMEBREW_LANGUAGES"] + @languages = ENV["HOMEBREW_LANGUAGES"].split(",") + @languages end + + if ARGV.value("language") + @languages = ARGV.value("language").split(",") + @languages + end + + @languages = @languages.uniq end def language -- cgit v1.2.3