summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-07-22 12:44:28 -0400
committerSamuel Giddins <segiddins@segiddins.me>2016-07-24 15:42:34 -0500
commit831c2729daae16ca65d9deb8a8a56eb62729b367 (patch)
tree887e3aa44bbc30bcb2b6b5b8fd86e60bca9f3fbc
parent2a138ed736b2210a21588db44b567dbdea6f7a18 (diff)
downloadbundler-seg-fix-bundle-help.tar.gz
Fix bundle --helpseg-fix-bundle-help
-rw-r--r--lib/bundler/cli.rb8
-rw-r--r--spec/commands/help_spec.rb14
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