Skip to content

Commit c1c2cb1

Browse files
Merge pull request #7601 from rubygems/deivid-rodriguez/bundle-help-package
Properly resolve aliases when `bundle help` is run (cherry picked from commit 34d94ea)
1 parent b6d85c6 commit c1c2cb1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bundler/lib/bundler/cli.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ def cli_help
114114
class_option "verbose", type: :boolean, desc: "Enable verbose output mode", aliases: "-V"
115115

116116
def help(cli = nil)
117+
cli = self.class.all_aliases[cli] if self.class.all_aliases[cli]
118+
117119
case cli
118120
when "gemfile" then command = "gemfile"
119121
when nil then command = "bundle"
@@ -683,7 +685,6 @@ def self.reformatted_help_args(args)
683685
exec_used = args.index {|a| exec_commands.include? a }
684686

685687
command = args.find {|a| bundler_commands.include? a }
686-
command = all_aliases[command] if all_aliases[command]
687688

688689
if exec_used && help_used
689690
if exec_used + help_used == 1

bundler/spec/commands/help_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
1616
end
1717

18+
it "prexifes bundle commands with bundle- and resolves aliases when finding the man files" do
19+
with_fake_man do
20+
bundle "help package"
21+
end
22+
expect(out).to eq(%(["#{man_dir}/bundle-cache.1"]))
23+
end
24+
1825
it "simply outputs the human readable file when there is no man on the path" do
1926
with_path_as("") do
2027
bundle "help install"

0 commit comments

Comments
 (0)