41 lines
835 B
Ruby
Raw Normal View History

2016-04-08 16:28:43 +02:00
#: * `irb` [`--examples`]:
#: Enter the interactive Homebrew Ruby shell.
#:
#: If `--examples` is passed, several examples will be shown.
require "formula"
require "keg"
require "irb"
2012-08-31 08:09:50 -04:00
class Symbol
def f(*args)
Formulary.factory(to_s, *args)
2012-08-31 08:09:50 -04:00
end
end
2017-02-23 06:04:32 +01:00
class String
def f(*args)
Formulary.factory(self, *args)
end
end
module Homebrew
2016-09-26 01:44:51 +02:00
module_function
def irb
2017-09-11 09:09:05 +02:00
$LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib")
require "hbc"
if ARGV.include? "--examples"
2014-06-19 19:13:45 -05:00
puts "'v8'.f # => instance of the v8 formula"
2012-08-31 08:09:50 -04:00
puts ":hub.f.installed?"
puts ":lua.f.methods - 1.methods"
puts ":mpd.f.recursive_dependencies.reject(&:installed?)"
else
ohai "Interactive Homebrew Shell"
puts "Example commands available with: brew irb --examples"
IRB.start
end
end
end