1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/lib/pry/bond_completer.rb
Robert Gleeson 97c28898e1 lazy load Pry::InputCompleter or Pry::BondCompleter
prior to commit both would be loaded but in most cases you'd only use
one or the other. when `bond` is available and `_pry_.config.completer`
has not been set to nil before the pry session has started & editline is
not being used(OSX only), then "pry/bond_completer" is loaded. otherwise
the default fallback is Pry::InputCompleter("pry/input_completer")
2014-03-16 04:24:12 +01:00

17 lines
571 B
Ruby

module Pry::BondCompleter
def self.call(input, options)
Pry.current[:pry] = options[:pry]
Bond.agent.call(input)
end
def self.start
Bond.start(:eval_binding => lambda{ Pry.current[:pry] && Pry.current[:pry].current_context })
Bond.complete(:on => /\A/) do |input|
Pry.commands.complete(input.line,
:pry_instance => Pry.current[:pry],
:target => Pry.current[:pry].current_context,
:command_set => Pry.current[:pry].commands)
end
self
end
end