highline 3.0.0.pre.1 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00a520ba256dca588d4af090b8a9c41d808bd208966d3d3eabaf17a5e5516ad1
4
- data.tar.gz: c0ab504488edce75cb6e290a119467ffb91ebbd9abbab3acedcc3da7198ad554
3
+ metadata.gz: 77aabe8e1a9f098383f7bdee9fb2fb985fe46ecd9faf59c676753bd59fef9da4
4
+ data.tar.gz: b7c90d18ba2adbdbab4ce5e20dd166ba812f506d7755429c12a955acc34bdfee
5
5
  SHA512:
6
- metadata.gz: '09efdc10dabb3dfedf2155faff822c845f819119f18abdcaa298607df6cf279ed955d693e31db5038509a16dbbee35f61fa18dc88591cfa6d2aa9543213d0129'
7
- data.tar.gz: c0a80e2ed2caaada155c2b66433dcafec06e0abb63bfe206470e65697b46f8a9888bbc7d2c64bb21f7cbf46218b5561a00f62f115f9d4355d098cbf911cf1523
6
+ metadata.gz: d708e26cdac5cd985562e57290cdfd8fecb3f6ca2d81bdff0c1e0c2c4ab006c98668b2c4346e0fdd24acd74f05db14f30d2cb5f870906538b9b1af44b0a3ed31
7
+ data.tar.gz: b0d5453c17c7ed667bd68b9ea208c4f5b78da1a0d101d01f69ec0299fb8eb8a234a5491053e148422542ed502ac7406711b6e6a30343c46be1c1eb611b159135
@@ -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.1'
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.1'
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,12 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
- ### 3.0.0.pre.1 / 2023-04-27
5
+ ### 3.0.1 / 2024-01-20
6
+ * PR #268 - Remove unused abbrev dependency (@zvkemp)
7
+
8
+ ### 3.0.0 / 2024-01-05
9
+ * PR #265 - Change Readline for Reline for Ruby 3.3 compat (@abinoam)
10
+ * PR #264 - Add abbrev gem as dependency (@mathieujobin)
6
11
  * PR #263 - Release 3.0.0.pre.1
7
12
  * Raise minimum Ruby version requirement to 3.0
8
13
  * PR #262 - Do not call stty on non-tty (@kbrock)
data/README.md CHANGED
@@ -139,7 +139,7 @@ For more examples see the examples/ directory of this project.
139
139
  Requirements
140
140
  ------------
141
141
 
142
- HighLine from version >= 1.7.0 requires ruby >= 1.9.3
142
+ HighLine from version >= 3.0.0 requires ruby >= 3.0.0
143
143
 
144
144
  Installing
145
145
  ----------
data/highline.gemspec CHANGED
@@ -33,4 +33,5 @@ DESCRIPTION
33
33
  spec.add_development_dependency "rake"
34
34
  spec.add_development_dependency "minitest"
35
35
  spec.add_development_dependency "dry-types"
36
+ spec.add_development_dependency "reline"
36
37
  end
@@ -116,7 +116,7 @@ class HighLine
116
116
  #
117
117
  attr_accessor :echo
118
118
  #
119
- # Use the Readline library to fetch input. This allows input editing as
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
- question.show_question(@highline)
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)
@@ -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 "readline" # load only if needed
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
- Readline.readline("", true)
126
+ prompt = highline.render_and_ident_statement(question)
127
+ Readline.readline(prompt, true)
126
128
  end
127
129
 
128
130
  $VERBOSE = old_verbose
@@ -2,5 +2,5 @@
2
2
 
3
3
  class HighLine
4
4
  # The version of the installed library.
5
- VERSION = "3.0.0.pre.1".freeze
5
+ VERSION = "3.0.1".freeze
6
6
  end
data/lib/highline.rb CHANGED
@@ -14,7 +14,6 @@ require "English"
14
14
  require "erb"
15
15
  require "optparse"
16
16
  require "stringio"
17
- require "abbrev"
18
17
  require "highline/terminal"
19
18
  require "highline/custom_errors"
20
19
  require "highline/question"
@@ -371,10 +370,8 @@ class HighLine
371
370
  #
372
371
  # @param statement [Statement, String] what to be said
373
372
  def say(statement)
374
- statement = render_statement(statement)
375
- return if statement.empty?
376
-
377
- statement = (indentation + statement)
373
+ statement = render_and_ident_statement(statement)
374
+ return statement if statement.empty?
378
375
 
379
376
  # Don't add a newline if statement ends with whitespace, OR
380
377
  # if statement ends with whitespace before a color escape code.
@@ -386,6 +383,18 @@ class HighLine
386
383
  end
387
384
  end
388
385
 
386
+ # Renders and indents a statement.
387
+ #
388
+ # Note: extracted here to be used by readline to render its prompt.
389
+ #
390
+ # @param statement [String] The statement to be rendered and indented.
391
+ # @return [String] The rendered and indented statement.
392
+ def render_and_ident_statement(statement)
393
+ statement = render_statement(statement)
394
+ statement = (indentation + statement) unless statement.empty?
395
+ statement
396
+ end
397
+
389
398
  # Renders a statement using {HighLine::Statement}
390
399
  # @param statement [String] any string
391
400
  # @return [Statement] rendered statement
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highline
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre.1
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edward Gray II
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-27 00:00:00.000000000 Z
11
+ date: 2024-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: reline
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: |
70
84
  A high-level IO library that provides validation, type conversion, and more for
71
85
  command-line interfaces. HighLine also includes a complete menu system that can
@@ -143,7 +157,7 @@ homepage: https://github.com/JEG2/highline
143
157
  licenses:
144
158
  - Ruby
145
159
  metadata: {}
146
- post_install_message:
160
+ post_install_message:
147
161
  rdoc_options: []
148
162
  require_paths:
149
163
  - lib
@@ -154,12 +168,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
168
  version: '3.0'
155
169
  required_rubygems_version: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - ">"
171
+ - - ">="
158
172
  - !ruby/object:Gem::Version
159
- version: 1.3.1
173
+ version: '0'
160
174
  requirements: []
161
- rubygems_version: 3.4.6
162
- signing_key:
175
+ rubygems_version: 3.5.3
176
+ signing_key:
163
177
  specification_version: 4
164
178
  summary: HighLine is a high-level command-line IO library.
165
179
  test_files: []