Project

tty-draft

0.0
The project is in a healthy, maintained state
Just like `TTY::Prompt#multiline` but let you move cursor around to edit before submission.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 0.1.1
~> 0.9.0
 Project Readme

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'

draft = TTY::Draft.new(
  prompt: ->(n){n==0 ? "\033[32m> \033[0m" : '  '}
)

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

License

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