From a4ebda3fc486e03940e4792e7478a41aada98852 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 1 Oct 2016 18:25:16 +0100 Subject: [PATCH] help: support `#:` help in external commands. Fixes https://github.com/Homebrew/homebrew-test-bot/issues/3 --- Library/Homebrew/brew.rb | 5 +---- Library/Homebrew/cmd/help.rb | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 1ba3fb8c26..f961a82f6f 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -75,12 +75,9 @@ begin end # Usage instructions should be displayed if and only if one of: - # - a help flag is passed AND an internal command is matched + # - a help flag is passed AND a command is matched # - a help flag is passed AND there is no command specified # - no arguments are passed - # - # It should never affect external commands so they can handle usage - # arguments themselves. if empty_argv || help_flag require "cmd/help" Homebrew.help cmd, empty_argv: empty_argv diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index 2a814b90ba..200e687385 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -39,6 +39,8 @@ module Homebrew if cmd cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) path = Commands.path(cmd) + path ||= which("brew-#{cmd}") + path ||= which("brew-#{cmd}.rb") end # Display command-specific (or generic) help in response to `UsageError`. @@ -61,7 +63,7 @@ module Homebrew exit 0 end - # Resume execution in `brew.rb` for external/unknown commands. + # Resume execution in `brew.rb` for unknown commands. return if path.nil? # Display help for internal command (or generic help if undocumented).