Class: Mysh::Console
Overview
A wrapper for the mysh console terminal.
Instance Method Summary collapse
-
#eoi? ⇒ Boolean
Have we reached the end of input?.
-
#get_command ⇒ Object
Get the initial line of command input.
-
#get_command_extra(str) ⇒ Object
Get additional lines of continued commands.
-
#handle_get_error(err, selector) ⇒ Object
Handle a readline error.
-
#initialize ⇒ Console
constructor
Setup the console wrapper.
Constructor Details
#initialize ⇒ Console
Setup the console wrapper.
10 11 12 |
# File 'lib/mysh/sources/console.rb', line 10 def initialize @eoi = false end |
Instance Method Details
#eoi? ⇒ Boolean
Have we reached the end of input?
42 43 44 |
# File 'lib/mysh/sources/console.rb', line 42 def eoi? @eoi end |
#get_command ⇒ Object
Get the initial line of command input.
15 16 17 18 19 20 21 |
# File 'lib/mysh/sources/console.rb', line 15 def get_command puts MNV[:pre_prompt] if MNV.key?(:pre_prompt) get(prompt: MNV[:prompt]) rescue MiniReadlinePLE => err retry unless handle_get_error(err, :prompt) exit end |
#get_command_extra(str) ⇒ Object
Get additional lines of continued commands.
24 25 26 27 28 29 |
# File 'lib/mysh/sources/console.rb', line 24 def get_command_extra(str) get(prompt: MNV[:post_prompt] + '\\', prefix: str[0]) rescue MiniReadlinePLE => err retry unless handle_get_error(err, :post_prompt) exit end |