File: multi_prompt.rb

package info (click to toggle)
ruby-tty-reader 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 804 kB
  • sloc: ruby: 1,759; sh: 4; makefile: 4
file content (14 lines) | stat: -rw-r--r-- 216 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

require_relative "../lib/tty-reader"

reader = TTY::Reader.new

reader.on(:keyctrl_x, :keyescape) do
  puts "Exiting..."
  exit
end

loop do
  reader.read_line("one\ntwo\nthree> ")
end