Methods

Class/Module Index [+]

Quicksearch

HammerCLI::ShellCommand

Public Instance Methods

execute() click to toggle source
# File lib/hammer_cli/shell.rb, line 82
def execute
  ShellMainCommand.load_commands(HammerCLI::MainCommand)

  if RUBY_VERSION >= "1.9"
    Readline.completion_append_character = ''
    Readline.completer_word_break_characters = ' ='
    Readline.completion_proc = complete_proc
  else
    Readline.completion_proc = lambda {}
  end

  stty_save = `stty -g`.chomp

  history = ShellHistory.new(Settings.get(:ui, :history_file) || DEFAULT_HISTORY_FILE)

  begin
    print_welcome_message
    while line = Readline.readline(prompt)

      history.push(line)

      line = HammerCLI::CompleterLine.new(line)
      ShellMainCommand.run('', line, context) unless line.empty?
    end
  rescue Interrupt => e
    puts
    system('stty', stty_save) # Restore
    exit
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.