tty-prompt 0.16.0 → 0.16.1
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 +6 -0
- data/Gemfile +1 -1
- data/README.md +34 -4
- data/examples/multi_select_disabled.rb +3 -3
- data/lib/tty/prompt.rb +1 -1
- data/lib/tty/prompt/enum_list.rb +3 -3
- data/lib/tty/prompt/expander.rb +3 -3
- data/lib/tty/prompt/list.rb +3 -3
- data/lib/tty/prompt/mask_question.rb +0 -1
- data/lib/tty/prompt/multiline.rb +0 -2
- data/lib/tty/prompt/question.rb +3 -1
- data/lib/tty/prompt/slider.rb +3 -3
- data/lib/tty/prompt/version.rb +1 -1
- data/tty-prompt.gemspec +1 -1
- 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: aec759d54706c89726d2a7a9b5ec7d7dd14c773c0cb1240e1ecf51c2a0b734c6
|
4
|
+
data.tar.gz: af25b5b8fe122644232e5e02fd2aea203bad75901d7dfa1d2c0605c4181035ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a44c4754daf0cabddbcce1a3863988603150df18364075ad0b9d2bef8193d16b3e0d67804f7553ace2f68c907cbcf9ad708f28442b5bd66c088400732bfa8101
|
7
|
+
data.tar.gz: 4253e5b3e30113775138f233c28a020291d3d20a70ed8f7e37c68407c62ebda1f09788909274c66c8e8e88cb4c855dd0085a13a89a9e42b7fc5174dabc05051c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.16.1] - 2018-04-29
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
* Fix key events subscription to only listen for the current prompt events
|
7
|
+
|
3
8
|
## [v0.16.0] - 2018-03-11
|
4
9
|
|
5
10
|
### Added
|
@@ -261,6 +266,7 @@
|
|
261
266
|
|
262
267
|
* Initial implementation and release
|
263
268
|
|
269
|
+
[v0.16.1]: https://github.com/piotrmurach/tty-prompt/compare/v0.16.0...v0.16.1
|
264
270
|
[v0.16.0]: https://github.com/piotrmurach/tty-prompt/compare/v0.15.0...v0.16.0
|
265
271
|
[v0.15.0]: https://github.com/piotrmurach/tty-prompt/compare/v0.14.0...v0.15.0
|
266
272
|
[v0.14.0]: https://github.com/piotrmurach/tty-prompt/compare/v0.13.2...v0.14.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -79,8 +79,9 @@ Or install it yourself as:
|
|
79
79
|
* [2.6.2.1 :disabled](#2621-disabled)
|
80
80
|
* [2.6.2.2 :filter](#2622-filter)
|
81
81
|
* [2.6.3 multi_select](#263-multi_select)
|
82
|
-
* [2.6.3.1 :
|
83
|
-
* [2.6.3.2 :
|
82
|
+
* [2.6.3.1 :disabled](#2631-disabled)
|
83
|
+
* [2.6.3.2 :echo](#2632-echo)
|
84
|
+
* [2.6.3.3 :filter](#2633-filter)
|
84
85
|
* [2.6.4 enum_select](#264-enum_select)
|
85
86
|
* [2.7 expand](#27-expand)
|
86
87
|
* [2.8 collect](#28-collect)
|
@@ -890,7 +891,36 @@ prompt.multi_select("Choose your letter?", letters, per_page: 4)
|
|
890
891
|
# (Move up or down to reveal more choices)
|
891
892
|
```
|
892
893
|
|
893
|
-
|
894
|
+
#### 2.6.3.1 `:disabled`
|
895
|
+
|
896
|
+
To disable menu choice, use the `:disabled` key with a value that explains the reason for the choice being unavailable. For example, out of all drinks, the sake and beer are currently out of stock:
|
897
|
+
|
898
|
+
```ruby
|
899
|
+
drinks = [
|
900
|
+
'bourbon',
|
901
|
+
{name: 'sake', disabled: '(out of stock)'},
|
902
|
+
'vodka',
|
903
|
+
{name: 'beer', disabled: '(out of stock)'},
|
904
|
+
'wine',
|
905
|
+
'whisky'
|
906
|
+
]
|
907
|
+
```
|
908
|
+
|
909
|
+
The disabled choice will be displaed with a cross `✘` character next to it and followed by an explanation:
|
910
|
+
|
911
|
+
```ruby
|
912
|
+
prompt.multi_select('Choose your favourite drink?', drinks)
|
913
|
+
# =>
|
914
|
+
# Choose your favourite drink? (Use arrow keys, press Space to select and Enter to finish)
|
915
|
+
# ‣ ⬡ bourbon
|
916
|
+
# ✘ sake (out of stock)
|
917
|
+
# ⬡ vodka
|
918
|
+
# ✘ beer (out of stock)
|
919
|
+
# ⬡ wine
|
920
|
+
# ⬡ whisky
|
921
|
+
```
|
922
|
+
|
923
|
+
#### 2.6.3.2 `:echo`
|
894
924
|
|
895
925
|
To control whether the selected items are shown on the question
|
896
926
|
header use the :echo option:
|
@@ -907,7 +937,7 @@ prompt.multi_select("Select drinks?", choices, echo: false)
|
|
907
937
|
# ‣ ⬢ 5) bourbon
|
908
938
|
```
|
909
939
|
|
910
|
-
|
940
|
+
#### 2.6.3.3 `:filter`
|
911
941
|
|
912
942
|
To activate dynamic list filtering on letter/number typing, use the :filter option:
|
913
943
|
|
@@ -5,13 +5,13 @@ require_relative "../lib/tty-prompt"
|
|
5
5
|
prompt = TTY::Prompt.new
|
6
6
|
|
7
7
|
drinks = [
|
8
|
+
'bourbon',
|
8
9
|
{name: 'sake', disabled: '(out of stock)'},
|
9
10
|
'vodka',
|
10
11
|
{name: 'beer', disabled: '(out of stock)'},
|
11
12
|
'wine',
|
12
|
-
'whisky'
|
13
|
-
'bourbon'
|
13
|
+
'whisky'
|
14
14
|
]
|
15
|
-
answer = prompt.multi_select('Choose your favourite drink?', drinks
|
15
|
+
answer = prompt.multi_select('Choose your favourite drink?', drinks)
|
16
16
|
|
17
17
|
puts answer.inspect
|
data/lib/tty/prompt.rb
CHANGED
@@ -76,7 +76,7 @@ module TTY
|
|
76
76
|
:show, :hide
|
77
77
|
|
78
78
|
def_delegators :@reader, :read_char, :read_line, :read_keypress,
|
79
|
-
:read_multiline, :on, :subscribe, :trigger,
|
79
|
+
:read_multiline, :on, :subscribe, :unsubscribe, :trigger,
|
80
80
|
:count_screen_lines
|
81
81
|
|
82
82
|
def_delegators :@output, :print, :puts, :flush
|
data/lib/tty/prompt/enum_list.rb
CHANGED
@@ -41,8 +41,6 @@ module TTY
|
|
41
41
|
@page_help = options[:page_help] || PAGE_HELP
|
42
42
|
@paginator = EnumPaginator.new
|
43
43
|
@page_active = @default
|
44
|
-
|
45
|
-
@prompt.subscribe(self)
|
46
44
|
end
|
47
45
|
|
48
46
|
# Set default option selected
|
@@ -122,7 +120,9 @@ module TTY
|
|
122
120
|
@question = question
|
123
121
|
block[self] if block
|
124
122
|
setup_defaults
|
125
|
-
|
123
|
+
@prompt.subscribe(self) do
|
124
|
+
render
|
125
|
+
end
|
126
126
|
end
|
127
127
|
|
128
128
|
def keypress(event)
|
data/lib/tty/prompt/expander.rb
CHANGED
@@ -31,8 +31,6 @@ module TTY
|
|
31
31
|
@status = :collapsed
|
32
32
|
@hint = nil
|
33
33
|
@default_key = false
|
34
|
-
|
35
|
-
@prompt.subscribe(self)
|
36
34
|
end
|
37
35
|
|
38
36
|
def expanded?
|
@@ -133,7 +131,9 @@ module TTY
|
|
133
131
|
block.call(self) if block
|
134
132
|
setup_defaults
|
135
133
|
choice(HELP_CHOICE)
|
136
|
-
|
134
|
+
@prompt.subscribe(self) do
|
135
|
+
render
|
136
|
+
end
|
137
137
|
end
|
138
138
|
|
139
139
|
private
|
data/lib/tty/prompt/list.rb
CHANGED
@@ -57,8 +57,6 @@ module TTY
|
|
57
57
|
@per_page = options[:per_page]
|
58
58
|
@page_help = options[:page_help] || PAGE_HELP
|
59
59
|
@paginator = Paginator.new
|
60
|
-
|
61
|
-
@prompt.subscribe(self)
|
62
60
|
end
|
63
61
|
|
64
62
|
# Set marker
|
@@ -183,7 +181,9 @@ module TTY
|
|
183
181
|
@question = question
|
184
182
|
block.call(self) if block
|
185
183
|
setup_defaults
|
186
|
-
|
184
|
+
@prompt.subscribe(self) do
|
185
|
+
render
|
186
|
+
end
|
187
187
|
end
|
188
188
|
|
189
189
|
# Check if list is enumerated
|
data/lib/tty/prompt/multiline.rb
CHANGED
data/lib/tty/prompt/question.rb
CHANGED
data/lib/tty/prompt/slider.rb
CHANGED
@@ -40,8 +40,6 @@ module TTY
|
|
40
40
|
@format = options.fetch(:format) { FORMAT }
|
41
41
|
@first_render = true
|
42
42
|
@done = false
|
43
|
-
|
44
|
-
@prompt.subscribe(self)
|
45
43
|
end
|
46
44
|
|
47
45
|
# Setup initial active position
|
@@ -100,7 +98,9 @@ module TTY
|
|
100
98
|
@question = question
|
101
99
|
block.call(self) if block
|
102
100
|
@active = initial
|
103
|
-
|
101
|
+
@prompt.subscribe(self) do
|
102
|
+
render
|
103
|
+
end
|
104
104
|
end
|
105
105
|
|
106
106
|
def keyleft(*)
|
data/lib/tty/prompt/version.rb
CHANGED
data/tty-prompt.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency 'pastel', '~> 0.7.0'
|
27
27
|
spec.add_dependency 'timers', '~> 4.0'
|
28
28
|
spec.add_dependency 'tty-cursor', '~> 0.5.0'
|
29
|
-
spec.add_dependency 'tty-reader', '~> 0.
|
29
|
+
spec.add_dependency 'tty-reader', '~> 0.3.0'
|
30
30
|
|
31
31
|
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
|
32
32
|
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.16.
|
4
|
+
version: 0.16.1
|
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
|
+
date: 2018-04-29 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.3.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.3.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|