aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/cat.rb
blob: 7439869d3060ecca0f3e22f6009f54150084e347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#:  * `cat` <formula>:
#:    Display the source to <formula>.

module Homebrew
  module_function

  def cat
    # do not "fix" this to support multiple arguments, the output would be
    # unparsable, if the user wants to cat multiple formula they can call
    # brew cat multiple times.
    formulae = ARGV.formulae
    raise FormulaUnspecifiedError if formulae.empty?
    raise "`brew cat` doesn't support multiple arguments" if formulae.size > 1

    cd HOMEBREW_REPOSITORY
    exec "cat", formulae.first.path, *ARGV.options_only
  end
end