diff options
| author | Xu Cheng | 2015-06-26 15:19:27 +0800 | 
|---|---|---|
| committer | Xu Cheng | 2015-07-03 14:22:38 +0800 | 
| commit | 78a7dea3a0f9acedd4151749fe351a52eeb5fa12 (patch) | |
| tree | 13c58bd7e323bd345ee5aa44e2df91871c21b819 /Library/Homebrew/cmd/command.rb | |
| parent | e537c6a59f488e3f59efa8ef6d4b0db0640887f0 (diff) | |
| download | brew-78a7dea3a0f9acedd4151749fe351a52eeb5fa12.tar.bz2 | |
add `brew command`
Closes Homebrew/homebrew#41034.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/cmd/command.rb')
| -rw-r--r-- | Library/Homebrew/cmd/command.rb | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb new file mode 100644 index 000000000..c2ea96dab --- /dev/null +++ b/Library/Homebrew/cmd/command.rb @@ -0,0 +1,14 @@ +module Homebrew +  def command +    cmd = ARGV.first +    cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) + +    if (path = HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb"; path.file?) +      puts path +    elsif (path = which("brew-#{cmd}") || which("brew-#{cmd}.rb")) +      puts path +    else +      odie "Unknown command: #{cmd}" +    end +  end +end | 
