Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyrylo/linenoise-rb
A Ruby wrapper around the small self-contained alternative to Readline and Libedit called Linenoise (https://github.com/antirez/linenoise).
https://github.com/kyrylo/linenoise-rb
console libedit linenoise readline readline-interface terminal
Last synced: 9 days ago
JSON representation
A Ruby wrapper around the small self-contained alternative to Readline and Libedit called Linenoise (https://github.com/antirez/linenoise).
- Host: GitHub
- URL: https://github.com/kyrylo/linenoise-rb
- Owner: kyrylo
- License: mit
- Created: 2018-11-24T19:02:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T07:29:35.000Z (almost 5 years ago)
- Last Synced: 2024-12-27T10:51:22.239Z (24 days ago)
- Topics: console, libedit, linenoise, readline, readline-interface, terminal
- Language: C
- Homepage:
- Size: 43 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Linenoise Ruby
==============[![CircleCI](https://circleci.com/gh/kyrylo/linenoise-rb.svg?style=svg)](https://circleci.com/gh/kyrylo/linenoise-rb)
[![Gem Version](https://badge.fury.io/rb/linenoise.svg)](http://badge.fury.io/rb/linenoise)
[![Documentation Status](http://inch-ci.org/github/kyrylo/linenoise.svg?branch=master)](http://inch-ci.org/github/kyrylo/linenoise)
[![Downloads](https://img.shields.io/gem/dt/linenoise.svg?style=flat)](https://rubygems.org/gems/linenoise)* [Documentation][documentation]
Introduction
------------The Linenoise gem is a wrapper around the small self-contained alternative to
Readline and Libedit called [Linenoise](https://github.com/antirez/linenoise).Features
--------* History support
* Completion
* Hints (suggestions at the right of the prompt as you type)
* Single and multiline editing mode with the usual key bindingsInstallation
------------### Bundler
Add the Linenoise gem to your Gemfile:
```ruby
gem 'linenoise', '~> 1.1'
```### Manual
Invoke the following command from your terminal:
```sh
gem install linenoise
```Examples
--------### Basic example
```ruby
require 'linenoise'while buf = Linenoise.linenoise('> ')
p buf
end
```### Completion
```ruby
require 'linenoise'LIST = %w[
search download open help history quit url next clear prev past
].freezeLinenoise.completion_proc = proc do |input|
LIST.grep(/\A#{Regexp.escape(input)}/)
endwhile line = Linenoise.linenoise('> ')
p line
end
```### Hints
```ruby
require 'linenoise'Linenoise.hint_proc = proc do |input|
case input
when /git show/
' [] [...]'
when /git log/
' [] []'
else
' --help'
end
endwhile line = Linenoise.linenoise('> ')
p line
end
```More examples and full API explanation is available on the
[documentation][documentation] page.Development
-----------### Running tests
```sh
bundle exec rake compile spec
```### Launching development console
```
bundle exec rake compile console
```Contact
-------In case you have a problem, question or a bug report, feel free to:
* [file an issue](https://github.com/kyrylo/linenoise-rb/issues)
* send me an email (see https://github.com/kyrylo)
* [tweet at me](https://twitter.com/kyrylosilin)License
-------The project uses the MIT License. See LICENSE.md for details.
[documentation]: https://www.rubydoc.info/github/kyrylo/linenoise-rb/Linenoise