mini_readline 0.4.8 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/mini_readline.rb +2 -2
- data/lib/mini_readline/read_line/edit/enter.rb +1 -0
- data/lib/mini_readline/version.rb +1 -1
- data/tests/mini_readline_tests.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51afb896300300688d6a75cf155988db14c54462
|
4
|
+
data.tar.gz: 3456c2ab788faa2a63ccfa0eafdbec96da32abf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c857932bb2fbd1c7e67c90c4fe7c9ab03a0ba5ad6280a381ae8a19220c1119d46d45f6170affb0d7c9075193da8ff4eac86ffc8628589744a90e95c9e2d8be2b
|
7
|
+
data.tar.gz: 29dd823603021ade6cb5458011a0dc90f29dc8749702543cfc15fe7a30c94b525c8c919e1d4ae29cbf8e3d6caf5d7679e904251cf3a1fb4cc0804b07146c33b6
|
data/README.md
CHANGED
@@ -11,19 +11,31 @@ irritating issues encountered when running under a Windows platform.
|
|
11
11
|
The mini_readline gem is designed for use with MRI version 1.9.3 or later.
|
12
12
|
The original readline tried to support older versions of Ruby.
|
13
13
|
|
14
|
+
**Note:** A pull request against the rb-readline project was submitted on
|
15
|
+
April 24, 2016. This fixes the outstanding issues with windows operation with
|
16
|
+
low risk to other platforms. However I do not much expect to come of this
|
17
|
+
effort. There are two year old pull request languishing away, so it looks like
|
18
|
+
support for the original rb-readline has ended. I will move forward with the
|
19
|
+
mini_readline gem as I can at least support my own code.
|
20
|
+
|
14
21
|
## Installation
|
22
|
+
|
15
23
|
Add this line to your application's Gemfile:
|
16
24
|
|
17
25
|
```ruby
|
18
26
|
gem 'mini_readline'
|
19
27
|
```
|
28
|
+
|
20
29
|
And then execute:
|
21
30
|
|
22
31
|
$ bundle
|
32
|
+
|
23
33
|
Or install it yourself as:
|
24
34
|
|
25
35
|
$ gem install mini_readline
|
26
36
|
|
37
|
+
The mini_readline gem itself is found at: ( https://rubygems.org/gems/mini_readline )
|
38
|
+
|
27
39
|
## Key Mappings
|
28
40
|
The mini_readline gem supports a simple set of editing commands. These vary
|
29
41
|
somewhat based on the system platform. The keyboard mappings (and alias
|
data/lib/mini_readline.rb
CHANGED
@@ -21,10 +21,10 @@ module MiniReadline
|
|
21
21
|
private_constant :NoHistory
|
22
22
|
|
23
23
|
#The shared instance of Readline.
|
24
|
-
@reader = Readline.new()
|
24
|
+
@reader = MiniReadline::Readline.new()
|
25
25
|
|
26
26
|
#The (limited) compatibility module function.
|
27
|
-
def self.readline(prompt, history = nil)
|
27
|
+
def self.readline(prompt = "", history = nil)
|
28
28
|
@reader.readline(prompt: prompt, history: history)
|
29
29
|
end
|
30
30
|
|
@@ -41,9 +41,9 @@ class MiniReadlineTester < Minitest::Test
|
|
41
41
|
result = ''
|
42
42
|
|
43
43
|
loop do
|
44
|
-
result = edit.readline(prompt: ">", history: true)
|
44
|
+
result = edit.readline(prompt: ">", history: true).chomp
|
45
45
|
puts result.inspect
|
46
|
-
break unless result !=
|
46
|
+
break unless result != "quit"
|
47
47
|
end
|
48
48
|
|
49
49
|
assert_equal("quit", result)
|
@@ -58,9 +58,9 @@ class MiniReadlineTester < Minitest::Test
|
|
58
58
|
result = ''
|
59
59
|
|
60
60
|
loop do
|
61
|
-
result = edit.readline(prompt: ">")
|
61
|
+
result = edit.readline(prompt: ">").chomp
|
62
62
|
puts result.inspect
|
63
|
-
break unless result !=
|
63
|
+
break unless result != "quit"
|
64
64
|
end
|
65
65
|
|
66
66
|
assert_equal("quit", result)
|
@@ -81,7 +81,7 @@ class MiniReadlineTester < Minitest::Test
|
|
81
81
|
array_src: fruit)
|
82
82
|
|
83
83
|
result = edit.readline(prompt: "\e[7mFruit:\e[0m ")
|
84
|
-
assert(fruit.include?(result))
|
84
|
+
assert(fruit.include?(result.chomp))
|
85
85
|
end
|
86
86
|
|
87
87
|
def test_block_complete
|
@@ -99,7 +99,7 @@ class MiniReadlineTester < Minitest::Test
|
|
99
99
|
array_src: lambda { fruit })
|
100
100
|
|
101
101
|
result = edit.readline(prompt: "Fruit: ")
|
102
|
-
assert(fruit.include?(result))
|
102
|
+
assert(fruit.include?(result.chomp))
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_file_auto
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_readline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|