TTY::Draft

Just like TTY::Prompt#multiline but let you move cursor around to edit before submission.

Installation

bundle add tty-draft

If bundler is not being used to manage dependencies, install the gem by executing:

gem install tty-draft

Usage

require 'tty-draft'

loop do
  puts TTY::Draft.gets
  puts "I see"
end
  • enter: new line
  • arrow keys: move cursor around
  • ctrl-d/ctrl-z: submit

License

The gem is available as open source under the terms of the MIT License.