355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
|
# File 'lib/enfcli.rb', line 355
def start
$stdout.sync = true
comp = proc { |s| Readline::HISTORY.grep(/^#{Regexp.escape(s)}/) }
Readline.completion_append_character = " "
Readline.completion_proc = comp
begin
stty_save = `stty -g`.chomp
rescue
stty_save = nil
end
trap("INT") {
system("stty", stty_save) if 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
|