mini_readline 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -11
- data/lib/mini_readline/options.rb +1 -1
- data/lib/mini_readline/version.rb +1 -1
- data/mini_readline.gemspec +1 -1
- data/sire.rb +6 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b99074b9e302cfad6d12453e21419394e8659d98
|
4
|
+
data.tar.gz: 8cdcf679fa4c2ae55420576aa45d885c3db7aabc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 568cb8c8337f78c7193e2792961cfa74a29e31432e1dfd54f3fa6daa569709b613512908990b4249f45ace3db009ae33abfd6991920e55f6e0d2fbf59b266060
|
7
|
+
data.tar.gz: da6334808b842adc057dd1a026738de4d33d9a2ec19f004911834c3d05a5efb4329b3b50aebb185692db75e815909f30e5432315e0738e60dc29b7132b6290c3
|
data/README.md
CHANGED
@@ -112,19 +112,20 @@ In native mode, instances of the Readline class are used to get user input.
|
|
112
112
|
edit = MiniReadline::Readline.new()
|
113
113
|
```
|
114
114
|
|
115
|
-
The constructor takes
|
115
|
+
The constructor takes two optional arguments. The first is either:
|
116
116
|
* An array of strings; A history buffer pre-loaded with commands.
|
117
117
|
* An empty array; A history buffer with no pre-load.
|
118
|
-
|
118
|
+
|
119
|
+
<br>The second is a hash of options that are used as instance level options.
|
119
120
|
|
120
121
|
<br>Once an instance is created it may be used as follows:
|
121
122
|
|
122
123
|
```ruby
|
123
124
|
edit.readline(prompt, options)
|
124
125
|
```
|
125
|
-
Where prompt is a prompt string and options is
|
126
|
-
|
127
|
-
history buffer of the edit object with:
|
126
|
+
Where prompt is a prompt string and options is an optional hash of options
|
127
|
+
settings. In addition, it is possible to get a hold
|
128
|
+
of the history buffer of the edit object with:
|
128
129
|
```ruby
|
129
130
|
hist = edit.history
|
130
131
|
```
|
@@ -134,6 +135,7 @@ menacing part of the history buffer.
|
|
134
135
|
```ruby
|
135
136
|
hist << "launch --weapons:nuclear --all"
|
136
137
|
```
|
138
|
+
<br>Maybe I should cut back on the Fallout/4?
|
137
139
|
|
138
140
|
### Options
|
139
141
|
In mini_readline, options exist at three levels:
|
@@ -163,7 +165,7 @@ BASE_OPTIONS = {
|
|
163
165
|
:alt_prompt => "<< ", #The prompt when scrolled.
|
164
166
|
#Set to nil for no alt prompt.
|
165
167
|
|
166
|
-
:auto_complete =>
|
168
|
+
:auto_complete => false, #Is auto complete enabled?
|
167
169
|
:auto_source => nil, #Filled in by auto_complete.rb
|
168
170
|
|
169
171
|
:history => false, #Is the history buffer enabled?
|
@@ -172,12 +174,24 @@ BASE_OPTIONS = {
|
|
172
174
|
|
173
175
|
:term => nil, #Filled in by raw_term.rb
|
174
176
|
|
175
|
-
:debug => false} #Used during development.
|
177
|
+
:debug => false} #Used during development only.
|
176
178
|
```
|
177
179
|
|
178
|
-
<br>
|
179
|
-
|
180
|
-
|
180
|
+
<br>While most of these options are self explanatory, a few could stand some
|
181
|
+
further description:
|
182
|
+
* :alt_prompt is the prompt used when the text must be scrolled to fit on the
|
183
|
+
screen.
|
184
|
+
* :auto_complete is disabled by default. Of course there are a number of ways
|
185
|
+
to enable it, or to make auto-complete enabled the default use:
|
186
|
+
```ruby
|
187
|
+
require 'mini_readline'
|
188
|
+
MiniReadline::BASE_OPTION[:auto_complete] = true
|
189
|
+
```
|
190
|
+
* :auto_source is the class of the source for auto-complete data. By default this
|
191
|
+
is MiniReadline::FileFolderSource. This option can be changed up to get auto-complete
|
192
|
+
data other than files and folders.
|
193
|
+
* :term is the interactive source of data, the console by default. This can be
|
194
|
+
changed to get data from another source (like a serial attached terminal).
|
181
195
|
|
182
196
|
#### Notes
|
183
197
|
* Since the compatibility mode does not accept an options hash, the only way to
|
@@ -239,7 +253,7 @@ To date this code has been tested under:
|
|
239
253
|
* Windows 7 with ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]
|
240
254
|
* Windows 7+Cygwin with ruby 2.2.3p173 (2015-08-18 revision 51636) [i386-cygwin]
|
241
255
|
|
242
|
-
<br>**More testing is clearly called for
|
256
|
+
<br>**More testing is clearly called for and suggestions/bug reports are most welcomed!!!**
|
243
257
|
|
244
258
|
## Contributing
|
245
259
|
|
data/mini_readline.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["peter.c.camilleri@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = "A simplified replacement for readline."
|
13
|
-
spec.description = "
|
13
|
+
spec.description = "A gem for console command entry with line edit "+
|
14
14
|
"and history. This gem is like the standard readline " +
|
15
15
|
"gem except that it has been redesigned, simplified, " +
|
16
16
|
"and extensively cleaned up."
|
data/sire.rb
CHANGED
@@ -5,23 +5,23 @@ require 'pp'
|
|
5
5
|
|
6
6
|
if ARGV[0] == 'old'
|
7
7
|
require 'readline'
|
8
|
-
puts "\nOption(old). Loaded the standard readline gem."
|
8
|
+
puts "\nOption(old). Loaded the standard readline gem. Version #{Readline::VERSION}"
|
9
9
|
elsif ARGV[0] == 'local'
|
10
10
|
require './lib/mini_readline'
|
11
|
-
puts "\nOption(local). Loaded mini_readline from the local code folder."
|
11
|
+
puts "\nOption(local). Loaded mini_readline from the local code folder. Version #{MiniReadline::VERSION}"
|
12
12
|
elsif defined?(MiniReadline)
|
13
|
-
puts "\nThe mini_readline gem is already loaded."
|
13
|
+
puts "\nThe mini_readline gem is already loaded. Version #{MiniReadline::VERSION}"
|
14
14
|
else
|
15
15
|
begin
|
16
16
|
require 'mini_readline'
|
17
|
-
puts "\nLoaded mini_readline from the system gem."
|
17
|
+
puts "\nLoaded mini_readline from the system gem. Version #{MiniReadline::VERSION}"
|
18
18
|
rescue LoadError
|
19
19
|
begin
|
20
20
|
require './lib/mini_readline'
|
21
|
-
puts "\nLoaded mini_readline from the local code folder."
|
21
|
+
puts "\nLoaded mini_readline from the local code folder. Version #{MiniReadline::VERSION}"
|
22
22
|
rescue LoadError
|
23
23
|
require 'readline'
|
24
|
-
puts "\nLoaded the standard readline gem."
|
24
|
+
puts "\nLoaded the standard readline gem. Version #{Readline::VERSION}"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
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.0
|
4
|
+
version: 0.1.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-01-
|
11
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -66,9 +66,9 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
|
-
description:
|
70
|
-
|
71
|
-
and extensively cleaned up.
|
69
|
+
description: A gem for console command entry with line edit and history. This gem
|
70
|
+
is like the standard readline gem except that it has been redesigned, simplified,
|
71
|
+
and extensively cleaned up.
|
72
72
|
email:
|
73
73
|
- peter.c.camilleri@gmail.com
|
74
74
|
executables: []
|