tty-prompt 0.17.2 → 0.18.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/CHANGELOG.md +12 -0
- data/README.md +2 -2
- data/examples/ask.rb +1 -1
- data/examples/ask_valid.rb +1 -1
- data/examples/collect.rb +1 -1
- data/examples/echo.rb +1 -1
- data/examples/enum_select.rb +1 -1
- data/examples/enum_select_disabled.rb +1 -1
- data/examples/enum_select_paged.rb +1 -1
- data/examples/enum_select_wrapped.rb +1 -1
- data/examples/expand.rb +1 -1
- data/examples/in.rb +1 -1
- data/examples/inputs.rb +1 -1
- data/examples/key_events.rb +5 -1
- data/examples/keypress.rb +1 -1
- data/examples/mask.rb +1 -1
- data/examples/multi_select.rb +1 -1
- data/examples/multi_select_disabled.rb +1 -1
- data/examples/multi_select_paged.rb +1 -1
- data/examples/multi_select_wrapped.rb +1 -1
- data/examples/multiline.rb +1 -1
- data/examples/pause.rb +1 -1
- data/examples/select.rb +1 -1
- data/examples/select_disabled.rb +1 -1
- data/examples/select_enum.rb +1 -1
- data/examples/select_filtered.rb +1 -1
- data/examples/select_paginated.rb +1 -1
- data/examples/select_wrapped.rb +1 -1
- data/examples/slider.rb +2 -2
- data/examples/validation.rb +1 -1
- data/examples/yes_no.rb +1 -1
- data/lib/tty-prompt.rb +0 -2
- data/lib/tty/prompt.rb +0 -1
- data/lib/tty/prompt/answers_collector.rb +0 -1
- data/lib/tty/prompt/choice.rb +0 -1
- data/lib/tty/prompt/choices.rb +0 -1
- data/lib/tty/prompt/confirm_question.rb +0 -1
- data/lib/tty/prompt/converter_dsl.rb +0 -1
- data/lib/tty/prompt/converter_registry.rb +0 -1
- data/lib/tty/prompt/converters.rb +0 -1
- data/lib/tty/prompt/distance.rb +0 -1
- data/lib/tty/prompt/enum_list.rb +0 -1
- data/lib/tty/prompt/enum_paginator.rb +0 -1
- data/lib/tty/prompt/evaluator.rb +0 -1
- data/lib/tty/prompt/expander.rb +0 -1
- data/lib/tty/prompt/keypress.rb +1 -2
- data/lib/tty/prompt/list.rb +0 -1
- data/lib/tty/prompt/mask_question.rb +0 -1
- data/lib/tty/prompt/multi_list.rb +0 -1
- data/lib/tty/prompt/multiline.rb +0 -1
- data/lib/tty/prompt/paginator.rb +0 -1
- data/lib/tty/prompt/question.rb +0 -1
- data/lib/tty/prompt/question/checks.rb +0 -1
- data/lib/tty/prompt/question/modifier.rb +0 -1
- data/lib/tty/prompt/question/validation.rb +0 -1
- data/lib/tty/prompt/result.rb +0 -1
- data/lib/tty/prompt/slider.rb +0 -1
- data/lib/tty/prompt/statement.rb +0 -1
- data/lib/tty/prompt/suggestion.rb +0 -1
- data/lib/tty/prompt/symbols.rb +0 -1
- data/lib/tty/prompt/timeout.rb +0 -1
- data/lib/tty/prompt/utils.rb +0 -1
- data/lib/tty/prompt/version.rb +1 -1
- data/lib/tty/test_prompt.rb +0 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/ask_spec.rb +1 -1
- data/spec/unit/choice/eql_spec.rb +1 -1
- data/spec/unit/choice/from_spec.rb +1 -1
- data/spec/unit/choices/add_spec.rb +1 -1
- data/spec/unit/choices/each_spec.rb +1 -1
- data/spec/unit/choices/find_by_spec.rb +1 -1
- data/spec/unit/choices/new_spec.rb +1 -1
- data/spec/unit/choices/pluck_spec.rb +1 -1
- data/spec/unit/collect_spec.rb +1 -1
- data/spec/unit/converters/convert_bool_spec.rb +1 -1
- data/spec/unit/converters/convert_char_spec.rb +1 -1
- data/spec/unit/converters/convert_custom_spec.rb +1 -1
- data/spec/unit/converters/convert_date_spec.rb +1 -1
- data/spec/unit/converters/convert_file_spec.rb +1 -1
- data/spec/unit/converters/convert_number_spec.rb +1 -1
- data/spec/unit/converters/convert_path_spec.rb +1 -1
- data/spec/unit/converters/convert_range_spec.rb +1 -1
- data/spec/unit/converters/convert_regex_spec.rb +1 -1
- data/spec/unit/converters/convert_string_spec.rb +1 -1
- data/spec/unit/converters/on_error_spec.rb +1 -1
- data/spec/unit/distance/distance_spec.rb +1 -1
- data/spec/unit/enum_paginator_spec.rb +1 -1
- data/spec/unit/enum_select_spec.rb +4 -4
- data/spec/unit/error_spec.rb +1 -1
- data/spec/unit/evaluator_spec.rb +1 -1
- data/spec/unit/expand_spec.rb +1 -1
- data/spec/unit/keypress_spec.rb +1 -1
- data/spec/unit/mask_spec.rb +1 -1
- data/spec/unit/multi_select_spec.rb +3 -3
- data/spec/unit/multiline_spec.rb +1 -1
- data/spec/unit/new_spec.rb +1 -1
- data/spec/unit/ok_spec.rb +1 -1
- data/spec/unit/paginator_spec.rb +1 -1
- data/spec/unit/question/checks_spec.rb +1 -1
- data/spec/unit/question/default_spec.rb +1 -1
- data/spec/unit/question/echo_spec.rb +1 -1
- data/spec/unit/question/in_spec.rb +1 -1
- data/spec/unit/question/initialize_spec.rb +1 -1
- data/spec/unit/question/modifier/apply_to_spec.rb +1 -1
- data/spec/unit/question/modifier/letter_case_spec.rb +1 -1
- data/spec/unit/question/modifier/whitespace_spec.rb +1 -1
- data/spec/unit/question/modify_spec.rb +1 -1
- data/spec/unit/question/required_spec.rb +1 -1
- data/spec/unit/question/validate_spec.rb +1 -1
- data/spec/unit/question/validation/call_spec.rb +1 -1
- data/spec/unit/question/validation/coerce_spec.rb +1 -1
- data/spec/unit/result_spec.rb +1 -1
- data/spec/unit/say_spec.rb +1 -1
- data/spec/unit/select_spec.rb +3 -3
- data/spec/unit/slider_spec.rb +1 -1
- data/spec/unit/statement/initialize_spec.rb +1 -1
- data/spec/unit/subscribe_spec.rb +2 -0
- data/spec/unit/suggest_spec.rb +1 -1
- data/spec/unit/warn_spec.rb +1 -1
- data/spec/unit/yes_no_spec.rb +1 -1
- data/tty-prompt.gemspec +1 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6b5dc469236b43c2439a9d62d9356d540c3aa0c3e359916b97fabc2ffe53a1f
|
4
|
+
data.tar.gz: '0229e21607f28ce8407e109d58b26b4d2d782a4f883e5a5580f5db022caa8e0d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0965a8ec33d8b6a00860e7f15fb6ebb731de62213b4322f732dc8a6c5b41c2da3030082fd3bca1a29e46f141d4233b9db4cbc7ddf9cd5b67632b184d34ca69f
|
7
|
+
data.tar.gz: 8c663d1388d1ec3adfa348e344d74bde55b5d2b61c33db30c877ea363a9e4a78f9723c9e36721912a6987395f93b1d25d4f5222abf0999795bb23bd5b97911f1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.18.0] - 2018-11-24
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Change to update tty-reader dependency
|
7
|
+
* Remove encoding magic comments
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
* Fix #keypress to stop using the :nonblock option
|
11
|
+
* Fix input reading to correctly capture the Esc key(#84)
|
12
|
+
* Fix line editing when cursor is on second to last character(#94)
|
13
|
+
|
3
14
|
## [v0.17.2] - 2018-11-01
|
4
15
|
|
5
16
|
### Fixed
|
@@ -285,6 +296,7 @@
|
|
285
296
|
|
286
297
|
* Initial implementation and release
|
287
298
|
|
299
|
+
[v0.18.0]: https://github.com/piotrmurach/tty-prompt/compare/v0.17.2...v0.18.0
|
288
300
|
[v0.17.2]: https://github.com/piotrmurach/tty-prompt/compare/v0.17.1...v0.17.2
|
289
301
|
[v0.17.1]: https://github.com/piotrmurach/tty-prompt/compare/v0.17.0...v0.17.1
|
290
302
|
[v0.17.0]: https://github.com/piotrmurach/tty-prompt/compare/v0.16.1...v0.17.0
|
data/README.md
CHANGED
@@ -644,7 +644,7 @@ end
|
|
644
644
|
# ‣ Jax
|
645
645
|
```
|
646
646
|
|
647
|
-
You can navigate the choices using the arrow keys or define your own
|
647
|
+
You can navigate the choices using the arrow keys or define your own key mappings (see [keyboard events](#212-keyboard-events). When reaching the top/bottom of the list, the selection does not cycle around by default. If you wish to enable cycling, you can pass `cycle: true` to `select` and `mutli_select`:
|
648
648
|
|
649
649
|
```ruby
|
650
650
|
prompt.select("Choose your destiny?", %w(Scorpion Kano Jax), cycle: true)
|
@@ -1405,4 +1405,4 @@ This project is intended to be a safe, welcoming space for collaboration, and co
|
|
1405
1405
|
|
1406
1406
|
## Copyright
|
1407
1407
|
|
1408
|
-
Copyright (c) 2015
|
1408
|
+
Copyright (c) 2015 Piotr Murach. See LICENSE for further details.
|
data/examples/ask.rb
CHANGED
data/examples/ask_valid.rb
CHANGED
data/examples/collect.rb
CHANGED
data/examples/echo.rb
CHANGED
data/examples/enum_select.rb
CHANGED
data/examples/expand.rb
CHANGED
data/examples/in.rb
CHANGED
data/examples/inputs.rb
CHANGED
data/examples/key_events.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../lib/tty-prompt"
|
4
4
|
|
@@ -8,4 +8,8 @@ prompt.on(:keypress) do |event|
|
|
8
8
|
puts "name: #{event.key.name}, value: #{event.value.dump}"
|
9
9
|
end
|
10
10
|
|
11
|
+
prompt.on(:keyescape) do |event|
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
11
15
|
prompt.read_keypress
|
data/examples/keypress.rb
CHANGED
data/examples/mask.rb
CHANGED
data/examples/multi_select.rb
CHANGED
data/examples/multiline.rb
CHANGED
data/examples/pause.rb
CHANGED
data/examples/select.rb
CHANGED
data/examples/select_disabled.rb
CHANGED
data/examples/select_enum.rb
CHANGED
data/examples/select_filtered.rb
CHANGED
data/examples/select_wrapped.rb
CHANGED
data/examples/slider.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../lib/tty-prompt"
|
4
4
|
|
5
5
|
prompt = TTY::Prompt.new
|
6
|
-
prompt.slider("Volume", max: 100, step: 5, default: 75, format: "|:slider| %d
|
6
|
+
prompt.slider("Volume", max: 100, step: 5, default: 75, format: "|:slider| %d%%")
|
data/examples/validation.rb
CHANGED
data/examples/yes_no.rb
CHANGED
data/lib/tty-prompt.rb
CHANGED
data/lib/tty/prompt.rb
CHANGED
data/lib/tty/prompt/choice.rb
CHANGED
data/lib/tty/prompt/choices.rb
CHANGED
data/lib/tty/prompt/distance.rb
CHANGED
data/lib/tty/prompt/enum_list.rb
CHANGED
data/lib/tty/prompt/evaluator.rb
CHANGED
data/lib/tty/prompt/expander.rb
CHANGED
data/lib/tty/prompt/keypress.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require_relative 'question'
|
@@ -75,7 +74,7 @@ module TTY
|
|
75
74
|
time do
|
76
75
|
@prompt.print(render_question)
|
77
76
|
until @done
|
78
|
-
@input = @prompt.read_keypress
|
77
|
+
@input = @prompt.read_keypress
|
79
78
|
end
|
80
79
|
end
|
81
80
|
@evaluator.(@input)
|
data/lib/tty/prompt/list.rb
CHANGED
data/lib/tty/prompt/multiline.rb
CHANGED
data/lib/tty/prompt/paginator.rb
CHANGED
data/lib/tty/prompt/question.rb
CHANGED
data/lib/tty/prompt/result.rb
CHANGED
data/lib/tty/prompt/slider.rb
CHANGED
data/lib/tty/prompt/statement.rb
CHANGED
data/lib/tty/prompt/symbols.rb
CHANGED
data/lib/tty/prompt/timeout.rb
CHANGED
data/lib/tty/prompt/utils.rb
CHANGED
data/lib/tty/prompt/version.rb
CHANGED
data/lib/tty/test_prompt.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/unit/ask_spec.rb
CHANGED
data/spec/unit/collect_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe TTY::Prompt do
|
4
4
|
let(:symbols) { TTY::Prompt::Symbols.symbols }
|
@@ -9,7 +9,7 @@ RSpec.describe TTY::Prompt do
|
|
9
9
|
error = options[:error]
|
10
10
|
default = options.fetch(:default, 1)
|
11
11
|
|
12
|
-
out =
|
12
|
+
out = []
|
13
13
|
out << prompt << " \n"
|
14
14
|
out << choices.map.with_index do |c, i|
|
15
15
|
name = c.is_a?(Hash) ? c[:name] : c
|
@@ -25,7 +25,7 @@ RSpec.describe TTY::Prompt do
|
|
25
25
|
end.join("\n")
|
26
26
|
out << "\n"
|
27
27
|
choice = " Choose 1-#{choices.count} [#{default}]: "
|
28
|
-
choice
|
28
|
+
choice = choice + input.to_s if input
|
29
29
|
out << choice
|
30
30
|
if error
|
31
31
|
out << "\n"
|
@@ -34,7 +34,7 @@ RSpec.describe TTY::Prompt do
|
|
34
34
|
end
|
35
35
|
out << "\e[2K\e[1G\e[1A" * (choices.count + 1)
|
36
36
|
out << "\e[2K\e[1G\e[J"
|
37
|
-
out
|
37
|
+
out.join
|
38
38
|
end
|
39
39
|
|
40
40
|
def exit_message(prompt, choice)
|
data/spec/unit/error_spec.rb
CHANGED
data/spec/unit/evaluator_spec.rb
CHANGED
data/spec/unit/expand_spec.rb
CHANGED
data/spec/unit/keypress_spec.rb
CHANGED
data/spec/unit/mask_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe TTY::Prompt do
|
4
4
|
let(:symbols) { TTY::Prompt::Symbols.symbols }
|
@@ -9,7 +9,7 @@ RSpec.describe TTY::Prompt do
|
|
9
9
|
init = options.fetch(:init, false)
|
10
10
|
enum = options[:enum]
|
11
11
|
|
12
|
-
out =
|
12
|
+
out = []
|
13
13
|
out << "\e[?25l" if init
|
14
14
|
out << prompt << " "
|
15
15
|
out << selected.join(', ')
|
@@ -33,7 +33,7 @@ RSpec.describe TTY::Prompt do
|
|
33
33
|
end.join("\n")
|
34
34
|
out << "\e[2K\e[1G\e[1A" * choices.count
|
35
35
|
out << "\e[2K\e[1G"
|
36
|
-
out
|
36
|
+
out.join
|
37
37
|
end
|
38
38
|
|
39
39
|
def exit_message(prompt, choices)
|
data/spec/unit/multiline_spec.rb
CHANGED
data/spec/unit/new_spec.rb
CHANGED
data/spec/unit/ok_spec.rb
CHANGED
data/spec/unit/paginator_spec.rb
CHANGED
data/spec/unit/result_spec.rb
CHANGED
data/spec/unit/say_spec.rb
CHANGED
data/spec/unit/select_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe TTY::Prompt, '#select' do
|
4
4
|
|
@@ -12,7 +12,7 @@ RSpec.describe TTY::Prompt, '#select' do
|
|
12
12
|
init = options.fetch(:init, false)
|
13
13
|
enum = options[:enum]
|
14
14
|
|
15
|
-
out =
|
15
|
+
out = []
|
16
16
|
out << "\e[?25l" if init
|
17
17
|
out << prompt << " "
|
18
18
|
out << "\e[90m(#{hint})\e[0m" if hint
|
@@ -32,7 +32,7 @@ RSpec.describe TTY::Prompt, '#select' do
|
|
32
32
|
out << "\e[2K\e[1G\e[1A" * choices.count
|
33
33
|
out << "\e[2K\e[1G"
|
34
34
|
out << "\e[1A\e[2K\e[1G" if choices.empty?
|
35
|
-
out
|
35
|
+
out.join
|
36
36
|
end
|
37
37
|
|
38
38
|
def exit_message(prompt, choice)
|
data/spec/unit/slider_spec.rb
CHANGED
data/spec/unit/subscribe_spec.rb
CHANGED
data/spec/unit/suggest_spec.rb
CHANGED
data/spec/unit/warn_spec.rb
CHANGED
data/spec/unit/yes_no_spec.rb
CHANGED
data/tty-prompt.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'tty/prompt/version'
|
@@ -26,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
26
25
|
spec.add_dependency 'pastel', '~> 0.7.0'
|
27
26
|
spec.add_dependency 'timers', '~> 4.0'
|
28
27
|
spec.add_dependency 'tty-cursor', '~> 0.6.0'
|
29
|
-
spec.add_dependency 'tty-reader', '~> 0.
|
28
|
+
spec.add_dependency 'tty-reader', '~> 0.5.0'
|
30
29
|
|
31
30
|
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
|
32
31
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-prompt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: necromancer
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.5.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.5.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|