webri 1.0.2 → 1.0.3
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/CHANGELOG.md +4 -0
- data/README.md +14 -1
- data/bin/webri +3 -0
- data/lib/webri/version.rb +1 -1
- data/lib/webri.rb +51 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c3d0d85a57c242ce0e81aa73823aef986a893a1f48e1d675d6b4d5a268cbb45
|
4
|
+
data.tar.gz: '050383f4ecf292a67ab9445f7fbbf5b1523be63062a642b4d74eaf9f20b766e8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f859eb825ce282a5198e7e50ee3114f71ecd39098b6416fa2538c79507cacf942366aa8c2c46e7c14b6d06e66b90f908fa8b756ce61d9c055920ba354fd60295
|
7
|
+
data.tar.gz: 8c31cc2229776e28c6f47320c7a2cdc8eb1d61157d3c10c10492e0dc7b682394c414a87bff694b25d21d3fad60ee2c82c2fe8ccc89dde7c69838177428bddc89
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# WebRI
|
1
|
+
# WebRI - Quick Access to Ruby Online Documentation
|
2
2
|
|
3
3
|
WebRI has a command-line utility, `webri`, for displaying Ruby online documentation.
|
4
4
|
|
@@ -335,6 +335,7 @@ Opening web page https://docs.ruby-lang.org/en/3.4/regexp/unicode_properties_rdo
|
|
335
335
|
To display the WebRI help text, use the special name `@help`:
|
336
336
|
|
337
337
|
```
|
338
|
+
$ ruby bin/webri
|
338
339
|
webri> @help
|
339
340
|
Showing help.
|
340
341
|
webri is a console application for displaying Ruby online HTML documentation.
|
@@ -347,6 +348,7 @@ For more information, see https://github.com/BurdetteLamar/webri/blob/main/READM
|
|
347
348
|
Options:
|
348
349
|
-i, --info Prints information about webri.
|
349
350
|
-r, --release=RELEASE Sets the Ruby release to document.
|
351
|
+
--noreline Does not use Reline (helps testing).
|
350
352
|
-n, --noop Does not actually open web pages.
|
351
353
|
-h, --help Prints this help.
|
352
354
|
-v, --version Prints the version of webri.
|
@@ -359,6 +361,14 @@ webri> @readme
|
|
359
361
|
Opening web page https://github.com/BurdetteLamar/webri/blob/main/README.md.
|
360
362
|
```
|
361
363
|
|
364
|
+
### Reline
|
365
|
+
|
366
|
+
`webri` uses [Reline](https://ruby.github.io/reline/Reline.html)
|
367
|
+
(on Linux, but not on other OS platforms).
|
368
|
+
|
369
|
+
Reline enables editing of text at the `webri` prompt (use left- and right-arrows),
|
370
|
+
and gives access to history (use up-arrow).
|
371
|
+
|
362
372
|
### Options
|
363
373
|
|
364
374
|
Option `--info` prints information about WebRI,
|
@@ -422,6 +432,8 @@ Opening web page https://docs.ruby-lang.org/en/3.4/Array.html.
|
|
422
432
|
Command: 'start https://docs.ruby-lang.org/en/3.4/Array.html'
|
423
433
|
```
|
424
434
|
|
435
|
+
Option `--noreline` blocks Reline behavior; see [Reline][6].
|
436
|
+
|
425
437
|
Option `--help` prints the WebRI help text.
|
426
438
|
|
427
439
|
Option `--version` prints the WebRI version.
|
@@ -454,3 +466,4 @@ to follow the [code of conduct](https://github.com/BurdetteLamar/webri/blob/mast
|
|
454
466
|
[3]: rdoc-ref:README.md@Instance+Method
|
455
467
|
[4]: rdoc-ref:README.md@Ruby+Page
|
456
468
|
[5]: rdoc-ref:README.md@Special+Names
|
469
|
+
[6]: rdoc-ref:README.md@Reline
|
data/bin/webri
CHANGED
@@ -28,6 +28,9 @@ end
|
|
28
28
|
parser.on('-r=RELEASE', '--release=RELEASE', 'Sets the Ruby release to document.') do |value|
|
29
29
|
options[:release] = value
|
30
30
|
end
|
31
|
+
parser.on('--noreline', 'Does not use Reline (helps testing).') do |value|
|
32
|
+
options[:noreline] = true
|
33
|
+
end
|
31
34
|
parser.on('-n', '--noop', 'Does not actually open web pages.') do |value|
|
32
35
|
options[:noop] = true
|
33
36
|
end
|
data/lib/webri/version.rb
CHANGED
data/lib/webri.rb
CHANGED
@@ -4,6 +4,7 @@ require 'rbconfig'
|
|
4
4
|
require 'open-uri'
|
5
5
|
require 'rexml'
|
6
6
|
require 'cgi'
|
7
|
+
require 'reline'
|
7
8
|
|
8
9
|
# TODO: Use reline.
|
9
10
|
#
|
@@ -37,6 +38,15 @@ class WebRI
|
|
37
38
|
get_toc_html
|
38
39
|
build_indexes
|
39
40
|
print_info if @info
|
41
|
+
print @noreline
|
42
|
+
if os_type == :linux && !@noreline
|
43
|
+
repl_reline
|
44
|
+
else
|
45
|
+
repl_plain
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def repl_plain # Read-evaluate-print loop, without Reline.
|
40
50
|
while true
|
41
51
|
$stdout.write('webri> ')
|
42
52
|
$stdout.flush
|
@@ -51,6 +61,46 @@ class WebRI
|
|
51
61
|
end
|
52
62
|
end
|
53
63
|
|
64
|
+
def repl_reline # Read-evaluate-print loop, with Reline.
|
65
|
+
begin
|
66
|
+
stty_save = `stty -g`.chomp
|
67
|
+
rescue
|
68
|
+
end
|
69
|
+
|
70
|
+
begin
|
71
|
+
completion_words= []
|
72
|
+
@index_for_type.each_pair do |type, index|
|
73
|
+
if type == :page
|
74
|
+
completion_words += index.keys.map {|name| 'ruby:' + name }
|
75
|
+
else
|
76
|
+
completion_words += index.keys
|
77
|
+
end
|
78
|
+
end
|
79
|
+
Reline.completion_proc = proc { |word|
|
80
|
+
completion_words
|
81
|
+
}
|
82
|
+
while line = Reline.readline("webri> ", true)
|
83
|
+
case line.chomp
|
84
|
+
when 'exit'
|
85
|
+
exit 0
|
86
|
+
when ''
|
87
|
+
# NOOP
|
88
|
+
else
|
89
|
+
if line.split(' ').size > 1
|
90
|
+
puts "One name at a time, please."
|
91
|
+
next
|
92
|
+
end
|
93
|
+
show(line)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
rescue Interrupt
|
97
|
+
puts '^C'
|
98
|
+
`stty #{stty_save}` if stty_save
|
99
|
+
exit 0
|
100
|
+
end
|
101
|
+
puts
|
102
|
+
end
|
103
|
+
|
54
104
|
def set_doc_release
|
55
105
|
supported_releases = []
|
56
106
|
unsupported_releases = []
|
@@ -176,6 +226,7 @@ class WebRI
|
|
176
226
|
def capture_options(options)
|
177
227
|
@noop = options[:noop]
|
178
228
|
@info = options[:info]
|
229
|
+
@noreline = options[:noreline]
|
179
230
|
@doc_release = options[:release]
|
180
231
|
end
|
181
232
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BurdetteLamar
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-06-
|
10
|
+
date: 2025-06-16 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Command-line utility for displaying Ruby online documentation
|
13
13
|
email:
|