highline 3.0.0.pre.1 → 3.0.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/.github/workflows/ci.yml +3 -2
- data/Changelog.md +3 -1
- data/README.md +1 -1
- data/highline.gemspec +2 -0
- data/lib/highline/question.rb +2 -6
- data/lib/highline/question_asker.rb +2 -1
- data/lib/highline/terminal.rb +6 -4
- data/lib/highline/version.rb +1 -1
- data/lib/highline.rb +14 -4
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 735a6b484551754886d61f83a5b2a8526c500a8e17302c000959de02d7cf5f82
|
4
|
+
data.tar.gz: a5a5a390bd2951386d1f82c8124e300ad77af2e16460272a18d0ce7615e90434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25d3b1034cdf2bae31625ec982f2ea0dbe8261e9b32ac7071ad8ef6d84ff6da9e872998f1388050f808bffeab8085d47da1c080b98e1523445d44739cd38e3a0
|
7
|
+
data.tar.gz: 70b42a24ef3b03046ffe82074b6b82acc5519fc37c6c07c95adf6b8edddeef66d211dcf5b44967460e2ec9116763a9871d668e8aaab5cff0cdb996958fc7fb50
|
data/.github/workflows/ci.yml
CHANGED
@@ -10,6 +10,7 @@ jobs:
|
|
10
10
|
os: [ubuntu-latest]
|
11
11
|
ruby-version:
|
12
12
|
- head
|
13
|
+
- '3.3'
|
13
14
|
- '3.2'
|
14
15
|
- '3.1'
|
15
16
|
- '3.0'
|
@@ -22,7 +23,7 @@ jobs:
|
|
22
23
|
- os: windows-latest
|
23
24
|
ruby-version: head
|
24
25
|
- os: windows-latest
|
25
|
-
ruby-version: '3.
|
26
|
+
ruby-version: '3.3'
|
26
27
|
- os: windows-latest
|
27
28
|
ruby-version: mingw
|
28
29
|
- os: windows-latest
|
@@ -32,7 +33,7 @@ jobs:
|
|
32
33
|
- os: macos-latest
|
33
34
|
ruby-version: 'head'
|
34
35
|
- os: macos-latest
|
35
|
-
ruby-version: '3.
|
36
|
+
ruby-version: '3.3'
|
36
37
|
runs-on: ${{ matrix.os }}
|
37
38
|
steps:
|
38
39
|
- uses: actions/checkout@v3
|
data/Changelog.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
Below is a complete listing of changes for each revision of HighLine.
|
4
4
|
|
5
|
-
### 3.0.0
|
5
|
+
### 3.0.0 / 2024-01-05
|
6
|
+
* PR #265 - Change Readline for Reline for Ruby 3.3 compat (@abinoam)
|
7
|
+
* PR #264 - Add abbrev gem as dependency (@mathieujobin)
|
6
8
|
* PR #263 - Release 3.0.0.pre.1
|
7
9
|
* Raise minimum Ruby version requirement to 3.0
|
8
10
|
* PR #262 - Do not call stty on non-tty (@kbrock)
|
data/README.md
CHANGED
data/highline.gemspec
CHANGED
@@ -29,8 +29,10 @@ DESCRIPTION
|
|
29
29
|
|
30
30
|
spec.required_ruby_version = ">= 3.0"
|
31
31
|
|
32
|
+
spec.add_runtime_dependency "abbrev"
|
32
33
|
spec.add_development_dependency "bundler"
|
33
34
|
spec.add_development_dependency "rake"
|
34
35
|
spec.add_development_dependency "minitest"
|
35
36
|
spec.add_development_dependency "dry-types"
|
37
|
+
spec.add_development_dependency "reline"
|
36
38
|
end
|
data/lib/highline/question.rb
CHANGED
@@ -116,7 +116,7 @@ class HighLine
|
|
116
116
|
#
|
117
117
|
attr_accessor :echo
|
118
118
|
#
|
119
|
-
# Use the
|
119
|
+
# Use the Reline library to fetch input. This allows input editing as
|
120
120
|
# well as keeping a history. In addition, tab will auto-complete
|
121
121
|
# within an Array of choices or a file listing.
|
122
122
|
#
|
@@ -125,6 +125,7 @@ class HighLine
|
|
125
125
|
# specified _input_ stream.
|
126
126
|
#
|
127
127
|
attr_accessor :readline
|
128
|
+
|
128
129
|
#
|
129
130
|
# Used to control whitespace processing for the answer to this question.
|
130
131
|
# See HighLine::Question.remove_whitespace() for acceptable settings.
|
@@ -580,11 +581,6 @@ class HighLine
|
|
580
581
|
end
|
581
582
|
end
|
582
583
|
|
583
|
-
# readline() needs to handle its own output, but readline only supports
|
584
|
-
# full line reading. Therefore if question.echo is anything but true,
|
585
|
-
# the prompt will not be issued. And we have to account for that now.
|
586
|
-
# Also, JRuby-1.7's ConsoleReader.readLine() needs to be passed the prompt
|
587
|
-
# to handle line editing properly.
|
588
584
|
# @param highline [HighLine] context
|
589
585
|
# @return [void]
|
590
586
|
def show_question(highline)
|
@@ -24,7 +24,8 @@ class HighLine
|
|
24
24
|
#
|
25
25
|
# @return [String] answer
|
26
26
|
def ask_once
|
27
|
-
|
27
|
+
# If in readline mode, let reline take care of the prompt
|
28
|
+
question.show_question(@highline) unless question.readline
|
28
29
|
|
29
30
|
begin
|
30
31
|
question.get_response_or_default(@highline)
|
data/lib/highline/terminal.rb
CHANGED
@@ -95,9 +95,9 @@ class HighLine
|
|
95
95
|
# Get one line using #readline_read
|
96
96
|
# @param (see #get_line)
|
97
97
|
def get_line_with_readline(question, highline)
|
98
|
-
require "
|
98
|
+
require "reline" # load only if needed
|
99
99
|
|
100
|
-
raw_answer = readline_read(question)
|
100
|
+
raw_answer = readline_read(question, highline)
|
101
101
|
|
102
102
|
if !raw_answer && highline.track_eof?
|
103
103
|
raise EOFError, "The input stream is exhausted."
|
@@ -109,7 +109,7 @@ class HighLine
|
|
109
109
|
# Use readline to read one line
|
110
110
|
# @param question [HighLine::Question] question from where to get
|
111
111
|
# autocomplete candidate strings
|
112
|
-
def readline_read(question)
|
112
|
+
def readline_read(question, highline)
|
113
113
|
# prep auto-completion
|
114
114
|
unless question.selection.empty?
|
115
115
|
Readline.completion_proc = lambda do |str|
|
@@ -117,12 +117,14 @@ class HighLine
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
+
# TODO: Check if this is still needed after Reline
|
120
121
|
# work-around ugly readline() warnings
|
121
122
|
old_verbose = $VERBOSE
|
122
123
|
$VERBOSE = nil
|
123
124
|
|
124
125
|
raw_answer = run_preserving_stty do
|
125
|
-
|
126
|
+
prompt = highline.render_and_ident_statement(question)
|
127
|
+
Readline.readline(prompt, true)
|
126
128
|
end
|
127
129
|
|
128
130
|
$VERBOSE = old_verbose
|
data/lib/highline/version.rb
CHANGED
data/lib/highline.rb
CHANGED
@@ -371,10 +371,8 @@ class HighLine
|
|
371
371
|
#
|
372
372
|
# @param statement [Statement, String] what to be said
|
373
373
|
def say(statement)
|
374
|
-
statement =
|
375
|
-
return if statement.empty?
|
376
|
-
|
377
|
-
statement = (indentation + statement)
|
374
|
+
statement = render_and_ident_statement(statement)
|
375
|
+
return statement if statement.empty?
|
378
376
|
|
379
377
|
# Don't add a newline if statement ends with whitespace, OR
|
380
378
|
# if statement ends with whitespace before a color escape code.
|
@@ -386,6 +384,18 @@ class HighLine
|
|
386
384
|
end
|
387
385
|
end
|
388
386
|
|
387
|
+
# Renders and indents a statement.
|
388
|
+
#
|
389
|
+
# Note: extracted here to be used by readline to render its prompt.
|
390
|
+
#
|
391
|
+
# @param statement [String] The statement to be rendered and indented.
|
392
|
+
# @return [String] The rendered and indented statement.
|
393
|
+
def render_and_ident_statement(statement)
|
394
|
+
statement = render_statement(statement)
|
395
|
+
statement = (indentation + statement) unless statement.empty?
|
396
|
+
statement
|
397
|
+
end
|
398
|
+
|
389
399
|
# Renders a statement using {HighLine::Statement}
|
390
400
|
# @param statement [String] any string
|
391
401
|
# @return [Statement] rendered statement
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: highline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Edward Gray II
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: abbrev
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: reline
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
description: |
|
70
98
|
A high-level IO library that provides validation, type conversion, and more for
|
71
99
|
command-line interfaces. HighLine also includes a complete menu system that can
|
@@ -154,11 +182,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
182
|
version: '3.0'
|
155
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
184
|
requirements:
|
157
|
-
- - "
|
185
|
+
- - ">="
|
158
186
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
187
|
+
version: '0'
|
160
188
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
189
|
+
rubygems_version: 3.5.3
|
162
190
|
signing_key:
|
163
191
|
specification_version: 4
|
164
192
|
summary: HighLine is a high-level command-line IO library.
|