288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/enfcli.rb', line 288
def start(host, user)
EnfCli::CTX.instance.prompt = user
EnfCli::CTX.instance.host = host
comp = proc { |s| Readline::HISTORY.grep(/^#{Regexp.escape(s)}/) }
Readline.completion_append_character = " "
Readline.completion_proc = comp
stty_save = `stty -g`.chomp
trap('INT') { system('stty', stty_save); exit }
while input = Readline.readline(EnfCli::CTX.instance.prompt, true)
break if input == "exit" or input == "\\q" or input == "quit"
Readline::HISTORY.pop if input == ""
execute(input) unless input == ""
end
end
|