highline 2.0.0.pre.develop.16 → 2.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/.github/workflows/ci.yml +50 -0
- data/.rubocop.yml +1 -2
- data/Changelog.md +24 -1
- data/Gemfile +2 -5
- data/README.md +1 -2
- data/examples/menus.rb +1 -1
- data/highline.gemspec +1 -1
- data/lib/highline/menu.rb +8 -6
- data/lib/highline/question.rb +0 -0
- data/lib/highline/style.rb +0 -0
- data/lib/highline/terminal/io_console.rb +9 -2
- data/lib/highline/terminal.rb +0 -2
- data/lib/highline/version.rb +1 -1
- data/lib/highline.rb +0 -0
- metadata +7 -9
- data/.travis.yml +0 -41
- data/appveyor.yml +0 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0bb41764d2e42ab3b3c52ca1735f0cd6a587ff5ed3bb4525d0e7703dc4ccb61f
|
|
4
|
+
data.tar.gz: 0424d1467c1f787881abfe6558afdc0aceeb0e854d05efac8c5c6db9d07ba3cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df0dd1fa4d206aace9512f7ad414bc1e6bdcbfe804fd91b3811a2bc5860dbe7862d3ab81a502fc812747134be1122a647ac9fdd8e95e88e3f9388f7a05f38c22
|
|
7
|
+
data.tar.gz: 70cbe01e01aeff63d8321a4768caaa43992082030ad4e3f93533693d7f7908b30175852c11286fe3a744c4a3a3be63ad3328e7b5b605a045ad4f634887e1340d
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
strategy:
|
|
8
|
+
fail-fast: false
|
|
9
|
+
matrix:
|
|
10
|
+
os: [ubuntu-latest]
|
|
11
|
+
ruby-version:
|
|
12
|
+
- head
|
|
13
|
+
- '3.2'
|
|
14
|
+
- '3.1'
|
|
15
|
+
- '3.0'
|
|
16
|
+
- '2.7'
|
|
17
|
+
- '2.6'
|
|
18
|
+
- '2.5'
|
|
19
|
+
- '2.4'
|
|
20
|
+
- '2.3'
|
|
21
|
+
- jruby
|
|
22
|
+
- jruby-head
|
|
23
|
+
- truffleruby
|
|
24
|
+
- truffleruby-head
|
|
25
|
+
- truffleruby+graalvm
|
|
26
|
+
include:
|
|
27
|
+
- os: windows-latest
|
|
28
|
+
ruby-version: head
|
|
29
|
+
- os: windows-latest
|
|
30
|
+
ruby-version: '3.1'
|
|
31
|
+
- os: windows-latest
|
|
32
|
+
ruby-version: mingw
|
|
33
|
+
- os: windows-latest
|
|
34
|
+
ruby-version: mswin
|
|
35
|
+
- os: windows-latest
|
|
36
|
+
ruby-version: ucrt
|
|
37
|
+
- os: macos-latest
|
|
38
|
+
ruby-version: 'head'
|
|
39
|
+
- os: macos-latest
|
|
40
|
+
ruby-version: '3.1'
|
|
41
|
+
runs-on: ${{ matrix.os }}
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v3
|
|
44
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
45
|
+
uses: ruby/setup-ruby@v1
|
|
46
|
+
with:
|
|
47
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
48
|
+
bundler-cache: true # 'bundle install' and cache
|
|
49
|
+
- name: Run tests
|
|
50
|
+
run: bundle exec rake test
|
data/.rubocop.yml
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# https://github.com/bbatsov/rubocop/tree/master/config
|
|
5
5
|
|
|
6
6
|
AllCops:
|
|
7
|
-
TargetRubyVersion: 1
|
|
7
|
+
TargetRubyVersion: 2.1
|
|
8
8
|
|
|
9
9
|
# General
|
|
10
10
|
|
|
@@ -50,7 +50,6 @@ Naming/MethodName:
|
|
|
50
50
|
# SupportedStyles: when_needed, always, never
|
|
51
51
|
Style/Encoding:
|
|
52
52
|
Enabled: true
|
|
53
|
-
EnforcedStyle: always
|
|
54
53
|
|
|
55
54
|
# If we fix this, it will change method signature.
|
|
56
55
|
# Save it for major release.
|
data/Changelog.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Below is a complete listing of changes for each revision of HighLine.
|
|
4
4
|
|
|
5
|
+
### 2.1.0 / 2022-12-31
|
|
6
|
+
* PR #255 - Change minimum Ruby version requirement to 2.3 (@abinoam)
|
|
7
|
+
* PR #254 - Improve Github Actions file (@abinoam)
|
|
8
|
+
* PR #253, PR #251 - Setup GitHub Actions and remove Travis (@petergoldstein, rev by @AlexWayfer)
|
|
9
|
+
* PR #250 - Fix file permissions (@bdunne)
|
|
10
|
+
|
|
11
|
+
### 2.0.3 / 2019-10-11
|
|
12
|
+
* PR #245 - Suppress `Psych.safe_load` arg warn (@koic)
|
|
13
|
+
|
|
14
|
+
### 2.0.2 / 2019-04-08
|
|
15
|
+
* PR #243 - Add new capital_letter option to menu index (@Ana06)
|
|
16
|
+
* This is a really special PR. It has come from "The Biggest
|
|
17
|
+
Mobprogramming Session Ever" and around 250 people
|
|
18
|
+
participated in crafting it!
|
|
19
|
+
* PR #241 - CI: Add 2.6 (@olleolleolle)
|
|
20
|
+
* PR #240 - Avoid YARD warning UnknownParam (@olleolleolle)
|
|
21
|
+
|
|
22
|
+
### 2.0.1 / 2019-01-23
|
|
23
|
+
* PR #238 / I #237 - Rescue Errno::ENOTTY when pipeing
|
|
24
|
+
|
|
25
|
+
### 2.0.0 / 2018-06-10
|
|
26
|
+
* Release 2.0.0 (major version release).
|
|
27
|
+
|
|
5
28
|
### 2.0.0-develop.16 / 2018-05-12
|
|
6
29
|
* PR #231 - Deprecate safe_level of ERB.new in Ruby 2.6 (@koic)
|
|
7
30
|
* PR #230 - Fix behavior when shell and gather options are selected together
|
|
@@ -573,7 +596,7 @@ Patch by Jeremy Hinegardner:
|
|
|
573
596
|
HighLine's own cross-platform terminal input routine.
|
|
574
597
|
* Improved type conversion to handle user defined classes.
|
|
575
598
|
|
|
576
|
-
### 0.2.0
|
|
599
|
+
### 0.2.0 / 2005-04-29
|
|
577
600
|
|
|
578
601
|
* Added Unit Tests to cover an already fixed output bug in the future.
|
|
579
602
|
* Added Rakefile and setup test action (default).
|
data/Gemfile
CHANGED
|
@@ -7,16 +7,13 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
|
7
7
|
# Specify your gem's dependencies in tgem.gemspec
|
|
8
8
|
gemspec
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
# Running only on MRI
|
|
12
|
-
gem "simplecov", group: :test
|
|
13
|
-
end
|
|
10
|
+
gem "simplecov", group: :test, require: false
|
|
14
11
|
|
|
15
12
|
group :code_quality do
|
|
16
13
|
gem "flog", require: false
|
|
17
14
|
gem "pronto", require: false, platform: :ruby
|
|
18
15
|
gem "pronto-flay", require: false, platform: :ruby
|
|
19
|
-
gem "pronto-poper", require: false, platform: :ruby
|
|
16
|
+
# gem "pronto-poper", require: false, platform: :ruby
|
|
20
17
|
gem "pronto-reek", require: false, platform: :ruby
|
|
21
18
|
gem "pronto-rubocop", require: false, platform: :ruby
|
|
22
19
|
end
|
data/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
HighLine
|
|
2
2
|
========
|
|
3
3
|
|
|
4
|
-
[](https://ci.appveyor.com/project/JEG2/highline/branch/master)
|
|
4
|
+
[](https://github.com/JEG2/highline/actions/workflows/ci.yml)
|
|
6
5
|
[](https://badge.fury.io/rb/highline)
|
|
7
6
|
[](https://codeclimate.com/github/JEG2/highline)
|
|
8
7
|
[](https://codeclimate.com/github/JEG2/highline/coverage)
|
data/examples/menus.rb
CHANGED
data/highline.gemspec
CHANGED
data/lib/highline/menu.rb
CHANGED
|
@@ -374,9 +374,10 @@ class HighLine
|
|
|
374
374
|
end
|
|
375
375
|
|
|
376
376
|
def map_items_by_index
|
|
377
|
-
if @index
|
|
378
|
-
|
|
379
|
-
|
|
377
|
+
if [:letter, :capital_letter].include?(@index)
|
|
378
|
+
# @ and ` are the previous ASCII characters to A and a respectively
|
|
379
|
+
prev_char = (@index == :capital_letter ? '@' : '`')
|
|
380
|
+
all_items.map { prev_char.succ!.dup }
|
|
380
381
|
else
|
|
381
382
|
(1..all_items.size).map(&:to_s)
|
|
382
383
|
end
|
|
@@ -436,7 +437,7 @@ class HighLine
|
|
|
436
437
|
|
|
437
438
|
# 97 is the "a" letter at ascii table
|
|
438
439
|
# Ex: For "a" it will return 0, and for "c" it will return 2
|
|
439
|
-
index = selection.ord - 97
|
|
440
|
+
index = selection.downcase.ord - 97
|
|
440
441
|
items[index]
|
|
441
442
|
end
|
|
442
443
|
|
|
@@ -517,8 +518,9 @@ class HighLine
|
|
|
517
518
|
case @index
|
|
518
519
|
when :number
|
|
519
520
|
["#{ix + 1}#{@index_suffix}", text]
|
|
520
|
-
when :letter
|
|
521
|
-
|
|
521
|
+
when :letter, :capital_letter
|
|
522
|
+
first_letter = (@index == :capital_letter ? 'A' : 'a')
|
|
523
|
+
["#{(first_letter.ord + ix).chr}#{@index_suffix}", text]
|
|
522
524
|
when :none
|
|
523
525
|
[text, ""]
|
|
524
526
|
else
|
data/lib/highline/question.rb
CHANGED
|
File without changes
|
data/lib/highline/style.rb
CHANGED
|
File without changes
|
|
@@ -1,28 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class HighLine
|
|
4
4
|
class Terminal
|
|
5
5
|
# io/console option for HighLine::Terminal.
|
|
6
6
|
# It's the most used terminal.
|
|
7
|
+
# TODO: We're rescuing when not a terminal.
|
|
8
|
+
# We should make a more robust implementation.
|
|
7
9
|
class IOConsole < Terminal
|
|
8
10
|
# (see Terminal#terminal_size)
|
|
9
11
|
def terminal_size
|
|
10
12
|
output.winsize.reverse
|
|
13
|
+
rescue Errno::ENOTTY
|
|
11
14
|
end
|
|
12
15
|
|
|
13
16
|
# (see Terminal#raw_no_echo_mode)
|
|
14
17
|
def raw_no_echo_mode
|
|
15
18
|
input.echo = false
|
|
19
|
+
rescue Errno::ENOTTY
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
# (see Terminal#restore_mode)
|
|
19
23
|
def restore_mode
|
|
20
24
|
input.echo = true
|
|
25
|
+
rescue Errno::ENOTTY
|
|
21
26
|
end
|
|
22
27
|
|
|
23
28
|
# (see Terminal#get_character)
|
|
24
|
-
def get_character
|
|
29
|
+
def get_character
|
|
25
30
|
input.getch # from ruby io/console
|
|
31
|
+
rescue Errno::ENOTTY
|
|
32
|
+
input.getc
|
|
26
33
|
end
|
|
27
34
|
end
|
|
28
35
|
end
|
data/lib/highline/terminal.rb
CHANGED
|
@@ -81,7 +81,6 @@ class HighLine
|
|
|
81
81
|
# Use readline if question has readline mode set.
|
|
82
82
|
# @param question [HighLine::Question]
|
|
83
83
|
# @param highline [HighLine]
|
|
84
|
-
# @param options [Hash]
|
|
85
84
|
def get_line(question, highline)
|
|
86
85
|
raw_answer =
|
|
87
86
|
if question.readline
|
|
@@ -108,7 +107,6 @@ class HighLine
|
|
|
108
107
|
end
|
|
109
108
|
|
|
110
109
|
# Use readline to read one line
|
|
111
|
-
# @param prompt [String] Readline prompt
|
|
112
110
|
# @param question [HighLine::Question] question from where to get
|
|
113
111
|
# autocomplete candidate strings
|
|
114
112
|
def readline_read(question)
|
data/lib/highline/version.rb
CHANGED
data/lib/highline.rb
CHANGED
|
File without changes
|
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: 2.
|
|
4
|
+
version: 2.1.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: 2022-12-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -66,10 +66,10 @@ extra_rdoc_files:
|
|
|
66
66
|
- Changelog.md
|
|
67
67
|
- LICENSE
|
|
68
68
|
files:
|
|
69
|
+
- ".github/workflows/ci.yml"
|
|
69
70
|
- ".gitignore"
|
|
70
71
|
- ".rubocop.yml"
|
|
71
72
|
- ".simplecov"
|
|
72
|
-
- ".travis.yml"
|
|
73
73
|
- AUTHORS
|
|
74
74
|
- COPYING
|
|
75
75
|
- Changelog.md
|
|
@@ -78,7 +78,6 @@ files:
|
|
|
78
78
|
- README.md
|
|
79
79
|
- Rakefile
|
|
80
80
|
- TODO
|
|
81
|
-
- appveyor.yml
|
|
82
81
|
- doc/.cvsignore
|
|
83
82
|
- examples/ansi_colors.rb
|
|
84
83
|
- examples/asking_for_arrays.rb
|
|
@@ -137,15 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
137
136
|
requirements:
|
|
138
137
|
- - ">="
|
|
139
138
|
- !ruby/object:Gem::Version
|
|
140
|
-
version:
|
|
139
|
+
version: '2.3'
|
|
141
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
141
|
requirements:
|
|
143
|
-
- - "
|
|
142
|
+
- - ">="
|
|
144
143
|
- !ruby/object:Gem::Version
|
|
145
|
-
version:
|
|
144
|
+
version: '0'
|
|
146
145
|
requirements: []
|
|
147
|
-
|
|
148
|
-
rubygems_version: 2.7.6
|
|
146
|
+
rubygems_version: 3.4.1
|
|
149
147
|
signing_key:
|
|
150
148
|
specification_version: 4
|
|
151
149
|
summary: HighLine is a high-level command-line IO library.
|
data/.travis.yml
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
language: ruby
|
|
3
|
-
dist: trusty
|
|
4
|
-
sudo: false
|
|
5
|
-
cache: bundler
|
|
6
|
-
script: "bundle exec rake test"
|
|
7
|
-
rvm:
|
|
8
|
-
- 2.0
|
|
9
|
-
- 2.1
|
|
10
|
-
- 2.2
|
|
11
|
-
- 2.3
|
|
12
|
-
- 2.4
|
|
13
|
-
- jruby-19mode # JRuby in 1.9 mode
|
|
14
|
-
- jruby-head
|
|
15
|
-
|
|
16
|
-
notifications:
|
|
17
|
-
email: false
|
|
18
|
-
matrix:
|
|
19
|
-
allow_failures:
|
|
20
|
-
- rvm: 1.9
|
|
21
|
-
- rvm: ruby-head
|
|
22
|
-
- rvm: rbx-3.81
|
|
23
|
-
- rvm: jruby-19mode # JRuby in 1.9 mode
|
|
24
|
-
- rvm: jruby-head
|
|
25
|
-
fast_finish: true
|
|
26
|
-
include:
|
|
27
|
-
- rvm: 1.9
|
|
28
|
-
before_install:
|
|
29
|
-
- "gem update --system -N"
|
|
30
|
-
- "gem update bundler -N"
|
|
31
|
-
- rvm: 2.5
|
|
32
|
-
before_install:
|
|
33
|
-
- gem install bundler
|
|
34
|
-
- rvm: ruby-head
|
|
35
|
-
before_install:
|
|
36
|
-
- gem install bundler
|
|
37
|
-
- rvm: rbx-3.81
|
|
38
|
-
before_install:
|
|
39
|
-
- gem install bundler
|
|
40
|
-
|
|
41
|
-
bundler_args: --without code_quality
|
data/appveyor.yml
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
version: 2.0.{build}-{branch}
|
|
2
|
-
|
|
3
|
-
cache:
|
|
4
|
-
- vendor/bundle
|
|
5
|
-
|
|
6
|
-
environment:
|
|
7
|
-
matrix:
|
|
8
|
-
- RUBY_VERSION: "193"
|
|
9
|
-
- RUBY_VERSION: "200"
|
|
10
|
-
- RUBY_VERSION: "200-x64"
|
|
11
|
-
- RUBY_VERSION: "21"
|
|
12
|
-
- RUBY_VERSION: "21-x64"
|
|
13
|
-
- RUBY_VERSION: "22"
|
|
14
|
-
- RUBY_VERSION: "22-x64"
|
|
15
|
-
- RUBY_VERSION: "23"
|
|
16
|
-
- RUBY_VERSION: "23-x64"
|
|
17
|
-
- RUBY_VERSION: "24"
|
|
18
|
-
- RUBY_VERSION: "24-x64"
|
|
19
|
-
|
|
20
|
-
matrix:
|
|
21
|
-
allow_failures:
|
|
22
|
-
- RUBY_VERSION: "193"
|
|
23
|
-
|
|
24
|
-
install:
|
|
25
|
-
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
|
26
|
-
- bundle config --local path vendor/bundle
|
|
27
|
-
- bundle install --retry=3 --without code_quality
|
|
28
|
-
|
|
29
|
-
build: off
|
|
30
|
-
|
|
31
|
-
before_test:
|
|
32
|
-
- ruby -v
|
|
33
|
-
- gem -v
|
|
34
|
-
- bundle -v
|
|
35
|
-
|
|
36
|
-
test_script:
|
|
37
|
-
- bundle exec rake
|