diff options
| -rw-r--r-- | lib/bundler/cli.rb | 8 | ||||
| -rw-r--r-- | spec/commands/help_spec.rb | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 30a306ec90..621deb0950 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -495,10 +495,12 @@ module Bundler else args end - elsif command.nil? - abort("Could not find command \"#{args.join(" ")}\".") - else + elsif help_used + args = args.dup + args.delete_at(help_used) ["help", command || args].flatten.compact + else + args end end diff --git a/spec/commands/help_spec.rb b/spec/commands/help_spec.rb index ef928080ef..02502846c6 100644 --- a/spec/commands/help_spec.rb +++ b/spec/commands/help_spec.rb @@ -83,6 +83,18 @@ describe "bundle help" do with_fake_man do bundle "instill -h", :expect_err => true end - expect(err).to include('Could not find command "instill -h --no-color".') + expect(out).to include('Could not find command "instill".') + end + + it "is called when only using the --help flag" do + with_fake_man do + bundle "--help" + end + expect(out).to eq(%(["#{root}/lib/bundler/man/bundle"])) + + with_fake_man do + bundle "-h" + end + expect(out).to eq(%(["#{root}/lib/bundler/man/bundle"])) end end |
