A Ruby wrapper around the small self-contained alternative to Readline and Libedit called Linenoise (https://github.com/antirez/linenoise).
MIT License
The Linenoise gem is a wrapper around the small self-contained alternative to Readline and Libedit called Linenoise.
Add the Linenoise gem to your Gemfile:
gem 'linenoise', '~> 1.1'
Invoke the following command from your terminal:
gem install linenoise
require 'linenoise'
while buf = Linenoise.linenoise('> ')
p buf
end
require 'linenoise'
LIST = %w[
search download open help history quit url next clear prev past
].freeze
Linenoise.completion_proc = proc do |input|
LIST.grep(/\A#{Regexp.escape(input)}/)
end
while line = Linenoise.linenoise('> ')
p line
end
require 'linenoise'
Linenoise.hint_proc = proc do |input|
case input
when /git show/
' [<options>] [<object>...]'
when /git log/
' [<options>] [<revision range>]'
else
' --help'
end
end
while line = Linenoise.linenoise('> ')
p line
end
More examples and full API explanation is available on the documentation page.
bundle exec rake compile spec
bundle exec rake compile console
In case you have a problem, question or a bug report, feel free to:
The project uses the MIT License. See LICENSE.md for details.