Class: HammerCLI::ShellCommand
- Inherits:
-
AbstractCommand
- Object
- Clamp::Command
- AbstractCommand
- HammerCLI::ShellCommand
- Defined in:
- lib/hammer_cli/shell.rb
Constant Summary collapse
- DEFAULT_HISTORY_FILE =
"~/.hammer_history"
Instance Method Summary collapse
Methods inherited from AbstractCommand
#adapter, build_options, #exception_handler, extend_help, #help, help, #initialize, #interactive?, option_builder, output, #output, output_definition, #output_definition, #parent_command, #parse, #run, validate_options, #validate_options
Methods included from Subcommand
Constructor Details
This class inherits a constructor from HammerCLI::AbstractCommand
Instance Method Details
#execute ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/hammer_cli/shell.rb', line 82 def execute ShellMainCommand.load_commands(HammerCLI::MainCommand) Readline.completion_append_character = '' Readline.completer_word_break_characters = ' =' Readline.completion_proc = complete_proc stty_save = `stty -g`.chomp history = ShellHistory.new(Settings.get(:ui, :history_file) || DEFAULT_HISTORY_FILE) begin while line = Readline.readline(prompt) history.push(line) line = HammerCLI::CompleterLine.new(line) ShellMainCommand.run('', line, context) unless line.empty? end rescue Interrupt; end puts system('stty', stty_save) # Restore HammerCLI::EX_OK end |