Merge pull request #2775 from reitermarkus/language
Fix `--language` option.
This commit is contained in:
commit
3fe32053a7
@ -21,14 +21,6 @@ if ARGV == %w[--version] || ARGV == %w[-v]
|
|||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def require?(path)
|
|
||||||
return false if path.nil?
|
|
||||||
require path
|
|
||||||
rescue LoadError => e
|
|
||||||
# we should raise on syntax errors but not if the file doesn't exist.
|
|
||||||
raise unless e.message.include?(path)
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
trap("INT", std_trap) # restore default CTRL-C handler
|
trap("INT", std_trap) # restore default CTRL-C handler
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ module Hbc
|
|||||||
option "--help", :help, false
|
option "--help", :help, false
|
||||||
|
|
||||||
# handled in OS::Mac
|
# handled in OS::Mac
|
||||||
option "--language a,b,c", ->(*) { raise OptionParser::InvalidOption }
|
option "--language a,b,c", ->(*) {}
|
||||||
|
|
||||||
# override default handling of --version
|
# override default handling of --version
|
||||||
option "--version", ->(*) { raise OptionParser::InvalidOption }
|
option "--version", ->(*) { raise OptionParser::InvalidOption }
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
describe Hbc::CLI, :cask do
|
describe Hbc::CLI, :cask do
|
||||||
it "lists the taps for Casks that show up in two taps" do
|
it "lists the taps for Casks that show up in two taps" do
|
||||||
listing = Hbc::CLI.nice_listing(%w[
|
listing = described_class.nice_listing(%w[
|
||||||
caskroom/cask/adium
|
caskroom/cask/adium
|
||||||
caskroom/cask/google-chrome
|
caskroom/cask/google-chrome
|
||||||
passcod/homebrew-cask/adium
|
passcod/homebrew-cask/adium
|
||||||
])
|
])
|
||||||
|
|
||||||
expect(listing).to eq(%w[
|
expect(listing).to eq(%w[
|
||||||
caskroom/cask/adium
|
caskroom/cask/adium
|
||||||
@ -13,6 +13,13 @@ describe Hbc::CLI, :cask do
|
|||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "ignores the `--language` option, which is handled in `OS::Mac`" do
|
||||||
|
cli = described_class.new("--language=en")
|
||||||
|
expect(cli).to receive(:detect_command_and_arguments).with(no_args)
|
||||||
|
expect(cli).to receive(:exit).with(1)
|
||||||
|
shutup { cli.run }
|
||||||
|
end
|
||||||
|
|
||||||
context "when no option is specified" do
|
context "when no option is specified" do
|
||||||
it "--binaries is true by default" do
|
it "--binaries is true by default" do
|
||||||
command = Hbc::CLI::Install.new("some-cask")
|
command = Hbc::CLI::Install.new("some-cask")
|
||||||
@ -41,7 +48,7 @@ describe Hbc::CLI, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "prints help output when subcommand receives `--help` flag" do
|
it "prints help output when subcommand receives `--help` flag" do
|
||||||
command = Hbc::CLI.new("noop", "--help")
|
command = described_class.new("noop", "--help")
|
||||||
expect(described_class).to receive(:run_command).with("help", "noop")
|
expect(described_class).to receive(:run_command).with("help", "noop")
|
||||||
command.run
|
command.run
|
||||||
expect(command.help?).to eq(true)
|
expect(command.help?).to eq(true)
|
||||||
@ -56,7 +63,7 @@ describe Hbc::CLI, :cask do
|
|||||||
|
|
||||||
it "exits with a status of 1 when something goes wrong" do
|
it "exits with a status of 1 when something goes wrong" do
|
||||||
allow(described_class).to receive(:lookup_command).and_raise(Hbc::CaskError)
|
allow(described_class).to receive(:lookup_command).and_raise(Hbc::CaskError)
|
||||||
command = Hbc::CLI.new("noop")
|
command = described_class.new("noop")
|
||||||
expect(command).to receive(:exit).with(1)
|
expect(command).to receive(:exit).with(1)
|
||||||
command.run
|
command.run
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,6 +15,14 @@ require "utils/svn"
|
|||||||
require "utils/tty"
|
require "utils/tty"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
|
def require?(path)
|
||||||
|
return false if path.nil?
|
||||||
|
require path
|
||||||
|
rescue LoadError => e
|
||||||
|
# we should raise on syntax errors but not if the file doesn't exist.
|
||||||
|
raise unless e.message.include?(path)
|
||||||
|
end
|
||||||
|
|
||||||
def ohai(title, *sput)
|
def ohai(title, *sput)
|
||||||
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
|
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
|
||||||
puts Formatter.headline(title, color: :blue)
|
puts Formatter.headline(title, color: :blue)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user