Module: CollinsShell::Console

Defined in:
lib/collins_shell/console.rb,
lib/collins_shell/console/asset.rb,
lib/collins_shell/console/cache.rb,
lib/collins_shell/console/commands.rb,
lib/collins_shell/console/filesystem.rb,
lib/collins_shell/console/commands/cd.rb,
lib/collins_shell/console/commands/io.rb,
lib/collins_shell/console/commands/cat.rb,
lib/collins_shell/console/commands/tail.rb,
lib/collins_shell/console/command_helpers.rb,
lib/collins_shell/console/options_helpers.rb,
lib/collins_shell/console/commands/versions.rb,
lib/collins_shell/console/commands/iterators.rb

Defined Under Namespace

Modules: Cache, CommandHelpers, Commands, OptionsHelpers Classes: Asset, Filesystem

Class Method Summary collapse

Class Method Details

.launch(options) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'lib/collins_shell/console.rb', line 49

def launch(options)
  self.options = options
  Pry.config.commands = get_pry_commands
  Pry.config.pager = true
  Pry.custom_completions = get_pry_custom_completions
  Pry.config.exception_handler = get_pry_exception_handler
  target = CollinsShell::Console::Filesystem.new options
  setup_pry_hooks
  Pry.start(target, :prompt => get_pry_prompt)
end

.optionsObject



62
63
64
# File 'lib/collins_shell/console.rb', line 62

def options
  @options
end

.options=(options) ⇒ Object



59
60
61
# File 'lib/collins_shell/console.rb', line 59

def options=(options)
  @options = options
end

.run_pry_command(command_string, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/collins_shell/console.rb', line 33

def run_pry_command command_string, options = {}
  options = {
    :show_output => true,
    :output => Pry.output,
    :commands => get_pry_commands
  }.merge!(options)
  output = options[:show_output] ? options[:output] : StringIO.new
  pry = Pry.new(
          :output => output, :input => StringIO.new(command_string),
          :commands => options[:commands], :prompt => proc{""}, :hooks => Pry::Hooks.new
  )
  if options[:binding_stack] then
    pry.binding_stack = options[:binding_stack]
  end
  pry.rep(options[:context])
end