Class: HammerCLI::ShellCommand
- Inherits:
-
AbstractCommand
- Object
- Clamp::Command
- AbstractCommand
- HammerCLI::ShellCommand
- Defined in:
- lib/hammer_cli/shell.rb
Instance Method Summary collapse
Methods inherited from AbstractCommand
#adapter, #exception_handler, inherited_output_definition, #initialize, output, #output, output_definition, #output_definition, #parent_command, #parse, remove_subcommand, #run, subcommand, subcommand!, validate_options, #validate_options
Methods included from Autocompletion
#autocomplete, #collect_all_options
Constructor Details
This class inherits a constructor from HammerCLI::AbstractCommand
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/hammer_cli/shell.rb', line 8 def execute Readline.completion_append_character = " " Readline.completer_word_break_characters = '' Readline.completion_proc = complete_proc stty_save = `stty -g`.chomp begin while line = Readline.readline('hammer> ', true) HammerCLI::MainCommand.run('hammer', line.split) unless line.start_with? 'shell' end rescue Interrupt => e puts system('stty', stty_save) # Restore exit end end |