tty-prompt 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile +8 -4
- data/README.md +229 -32
- data/benchmarks/speed.rb +27 -0
- data/examples/collect.rb +19 -0
- data/examples/expand.rb +29 -0
- data/lib/tty-prompt.rb +3 -0
- data/lib/tty/prompt.rb +82 -21
- data/lib/tty/prompt/answers_collector.rb +59 -0
- data/lib/tty/prompt/choice.rb +9 -2
- data/lib/tty/prompt/choices.rb +17 -1
- data/lib/tty/prompt/confirm_question.rb +140 -0
- data/lib/tty/prompt/enum_list.rb +15 -12
- data/lib/tty/prompt/expander.rb +288 -0
- data/lib/tty/prompt/list.rb +14 -8
- data/lib/tty/prompt/mask_question.rb +2 -2
- data/lib/tty/prompt/multi_list.rb +14 -4
- data/lib/tty/prompt/question.rb +8 -10
- data/lib/tty/prompt/slider.rb +9 -7
- data/lib/tty/prompt/version.rb +1 -1
- data/spec/unit/ask_spec.rb +68 -0
- data/spec/unit/choice/from_spec.rb +7 -1
- data/spec/unit/choices/find_by_spec.rb +10 -0
- data/spec/unit/choices/pluck_spec.rb +4 -4
- data/spec/unit/collect_spec.rb +33 -0
- data/spec/unit/converters/convert_bool_spec.rb +1 -1
- data/spec/unit/enum_select_spec.rb +20 -1
- data/spec/unit/expand_spec.rb +198 -0
- data/spec/unit/multi_select_spec.rb +39 -2
- data/spec/unit/select_spec.rb +28 -5
- data/spec/unit/slider_spec.rb +15 -0
- data/spec/unit/yes_no_spec.rb +149 -14
- data/tty-prompt.gemspec +1 -2
- metadata +15 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a61159db722c1c9c3be87b952db58198825cda3
|
4
|
+
data.tar.gz: bf536fe71b19528ee38f2fea21efae414c32bb2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f90ed4437bd6d5d7a14230ea1d0b31fc41129333c11ab65c0a6473f1f60ad938bc3b66061f103dc42c179df8464ac24263332e0fc2b6ce31a65e3c5990a472a8
|
7
|
+
data.tar.gz: 55b5ffcfc01d21d0584a9e630c9544a5314701091e4d9d6733be5284d1d134e7c09274335efe07aa8c794c0167b6599b295343a9ddb40a1b63728c2901852fc8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.5.0] - 2016-03-28
|
4
|
+
|
5
|
+
### Added
|
6
|
+
* Add ConfirmQuestion for #yes? & #no? calls
|
7
|
+
* Add ability to collect more than one answer through #collect call
|
8
|
+
* Add Choices#find_by for selecting choice based on attribute
|
9
|
+
* Add Prompt#expand for expanding key options
|
10
|
+
* Add :active_color, :help_color, :prefix options for customizing prompts display
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
* Change Choice#from to allow for coersion of complex objects with keys
|
14
|
+
* Change Choices#pluck to search through object attributes
|
15
|
+
* Change #select :enum option help text to display actual numbers range
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
* Fix #no? to correctly ask negative question by @ondra-m
|
19
|
+
* Fix #ask :default option to handle nil or empty string
|
20
|
+
* Fix #multi_select :default option and color changing
|
21
|
+
|
3
22
|
## [v0.4.0] - 2016-02-08
|
4
23
|
|
5
24
|
### Added
|
@@ -58,6 +77,7 @@
|
|
58
77
|
|
59
78
|
* Initial implementation and release
|
60
79
|
|
80
|
+
[v0.5.0]: https://github.com/peter-murach/tty-prompt/compare/v0.4.0...v0.5.0
|
61
81
|
[v0.4.0]: https://github.com/peter-murach/tty-prompt/compare/v0.3.0...v0.4.0
|
62
82
|
[v0.3.0]: https://github.com/peter-murach/tty-prompt/compare/v0.2.0...v0.3.0
|
63
83
|
[v0.2.0]: https://github.com/peter-murach/tty-prompt/compare/v0.1.0...v0.2.0
|
data/Gemfile
CHANGED
@@ -2,14 +2,18 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
group :
|
6
|
-
gem '
|
5
|
+
group :test do
|
6
|
+
gem 'rspec', '~> 3.4.0'
|
7
7
|
gem 'benchmark-ips', '~> 2.0.0'
|
8
|
+
gem 'simplecov', '~> 0.10.0'
|
9
|
+
gem 'coveralls', '~> 0.8.2'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :tools do
|
8
13
|
gem 'byebug', platform: :mri
|
9
14
|
end
|
10
15
|
|
11
16
|
group :metrics do
|
12
|
-
gem '
|
13
|
-
gem 'simplecov', '~> 0.10.0'
|
17
|
+
gem 'yard', '~> 0.8.7'
|
14
18
|
gem 'yardstick', '~> 0.9.9'
|
15
19
|
end
|
data/README.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# TTY::Prompt
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/tty-prompt.svg)][gem]
|
3
|
-
[![Build Status](https://secure.travis-ci.org/
|
4
|
-
[![Code Climate](https://codeclimate.com/github/
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/
|
6
|
-
[![Inline docs](http://inch-ci.org/github/
|
3
|
+
[![Build Status](https://secure.travis-ci.org/piotrmurach/tty-prompt.svg?branch=master)][travis]
|
4
|
+
[![Code Climate](https://codeclimate.com/github/piotrmurach/tty-prompt/badges/gpa.svg)][codeclimate]
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/piotrmurach/tty-prompt/badge.svg)][coverage]
|
6
|
+
[![Inline docs](http://inch-ci.org/github/piotrmurach/tty-prompt.svg?branch=master)][inchpages]
|
7
7
|
|
8
8
|
[gem]: http://badge.fury.io/rb/tty-prompt
|
9
|
-
[travis]: http://travis-ci.org/
|
10
|
-
[codeclimate]: https://codeclimate.com/github/
|
11
|
-
[coverage]: https://coveralls.io/r/
|
12
|
-
[inchpages]: http://inch-ci.org/github/
|
9
|
+
[travis]: http://travis-ci.org/piotrmurach/tty-prompt
|
10
|
+
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-prompt
|
11
|
+
[coverage]: https://coveralls.io/r/piotrmurach/tty-prompt
|
12
|
+
[inchpages]: http://inch-ci.org/github/piotrmurach/tty-prompt
|
13
13
|
|
14
14
|
> A beautiful and powerful interactive command line prompt.
|
15
15
|
|
16
|
-
**TTY::Prompt** provides independent prompt component for [TTY](https://github.com/
|
16
|
+
**TTY::Prompt** provides independent prompt component for [TTY](https://github.com/piotrmurach/tty) toolkit.
|
17
17
|
|
18
18
|
## Features
|
19
19
|
|
@@ -51,6 +51,9 @@ Or install it yourself as:
|
|
51
51
|
* [2.2.6 required](#226-required)
|
52
52
|
* [2.2.7 validate](#227-validate)
|
53
53
|
* [2.2.8 messages](#228-messages)
|
54
|
+
* [2.2.9 prefix](#229-prefix)
|
55
|
+
* [2.2.10 active_color](#2210-active_color)
|
56
|
+
* [2.2.11 help_color](#2211-help_color)
|
54
57
|
* [2.3 keypress](#23-keypress)
|
55
58
|
* [2.4 multiline](#24-multiline)
|
56
59
|
* [2.5 mask](#25-mask)
|
@@ -58,12 +61,14 @@ Or install it yourself as:
|
|
58
61
|
* [2.7 select](#27-select)
|
59
62
|
* [2.8 multi_select](#28-multi_select)
|
60
63
|
* [2.9 enum_select](#29-enum_select)
|
61
|
-
* [2.10
|
62
|
-
* [2.11
|
63
|
-
* [2.12
|
64
|
-
* [2.13
|
65
|
-
* [2.14
|
66
|
-
* [2.15
|
64
|
+
* [2.10 expand](#210-expand)
|
65
|
+
* [2.11 collect](#211-collect)
|
66
|
+
* [2.12 suggest](#212-suggest)
|
67
|
+
* [2.13 slider](#213-slider)
|
68
|
+
* [2.14 say](#214-say)
|
69
|
+
* [2.15 ok](#215-ok)
|
70
|
+
* [2.16 warn](#216-warn)
|
71
|
+
* [2.17 error](#217-warn)
|
67
72
|
|
68
73
|
## 1. Usage
|
69
74
|
|
@@ -124,7 +129,7 @@ To ask for a selection from enumerated list you can use `enum_select`:
|
|
124
129
|
|
125
130
|
```ruby
|
126
131
|
choices = %w(emacs nano vim)
|
127
|
-
prompt.enum_select("Select an editor?")
|
132
|
+
prompt.enum_select("Select an editor?", choices)
|
128
133
|
# =>
|
129
134
|
#
|
130
135
|
# Select an editor?
|
@@ -134,6 +139,39 @@ prompt.enum_select("Select an editor?")
|
|
134
139
|
# Choose 1-3 [2]:
|
135
140
|
```
|
136
141
|
|
142
|
+
However, if you have a lot of options to choose from you may want to use `expand`:
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
choices = [
|
146
|
+
{ key: 'y', name: 'overwrite this file', value: :yes },
|
147
|
+
{ key: 'n', name: 'do not overwrite this file', value: :no },
|
148
|
+
{ key: 'a', name: 'overwrite this file and all later files', value: :all },
|
149
|
+
{ key: 'd', name: 'show diff', value: :diff },
|
150
|
+
{ key: 'q', name: 'quit; do not overwrite this file ', value: :quit }
|
151
|
+
]
|
152
|
+
prompt.expand('Overwrite Gemfile?', choices)
|
153
|
+
# =>
|
154
|
+
# Overwrite Gemfile? (enter "h" for help) [y,n,a,d,q,h]
|
155
|
+
```
|
156
|
+
|
157
|
+
If you wish to collect more than one answer use `collect`:
|
158
|
+
|
159
|
+
```ruby
|
160
|
+
result = prompt.collect do
|
161
|
+
key(:name).ask('Name?')
|
162
|
+
|
163
|
+
key(:age).ask('Age?', convert: :int)
|
164
|
+
|
165
|
+
key(:address) do
|
166
|
+
key(:street).ask('Street?', required: true)
|
167
|
+
key(:city).ask('City?')
|
168
|
+
key(:zip).ask('Zip?', validate: /\A\d{3}\Z/)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
# =>
|
172
|
+
# {:name => "Piotr", :age => 30, :address => {:street => "Street", :city => "City", :zip => "123"}}
|
173
|
+
```
|
174
|
+
|
137
175
|
## 2. Interface
|
138
176
|
|
139
177
|
### 2.1 ask
|
@@ -300,6 +338,32 @@ prompt.ask('What is your email?') do |q|
|
|
300
338
|
end
|
301
339
|
```
|
302
340
|
|
341
|
+
### 2.2.9 prefix
|
342
|
+
|
343
|
+
You can prefix each question asked using the `:prefix` option. This option can be applied either globally for all prompts or individual for each one:
|
344
|
+
|
345
|
+
```ruby
|
346
|
+
prompt = TTY::Prompt.new(prefix: '[?] ')
|
347
|
+
```
|
348
|
+
|
349
|
+
### 2.2.10 active_color
|
350
|
+
|
351
|
+
All prompt types support `:active_color` option. In case of `select`, `multi_select`, `enum_select` or `expand` this color is used to highlight the currently selected choice. All the resulted inputs provided by user that are read in by the prompt as answer are highlighted with this color. This option can be applied either globablly for all prompts or individually.
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
prompt.select('What size?', %w(Large Medium Small), active_color: :cyan)
|
355
|
+
```
|
356
|
+
|
357
|
+
Please (see pastel)[https://github.com/piotrmurach/pastel#3-supported-colors] for all supported colors.
|
358
|
+
|
359
|
+
### 2.2.11 help_color
|
360
|
+
|
361
|
+
Prompts such as `select`, `multi_select`, `expand` support `:help_color` which is used to customize the help text. This option can be applied either globablly for all prompts or individually.
|
362
|
+
|
363
|
+
```ruby
|
364
|
+
prompt.select('What size?', %w(Large Medium Small), help_color: :cyan)
|
365
|
+
```
|
366
|
+
|
303
367
|
### 2.3 keypress
|
304
368
|
|
305
369
|
In order to ask question with a single character or keypress answer use `keypress`:
|
@@ -350,13 +414,44 @@ prompt.yes?('Do you like Ruby?')
|
|
350
414
|
# Do you like Ruby? (Y/n)
|
351
415
|
```
|
352
416
|
|
353
|
-
|
417
|
+
You can further customize question by passing `suffix`, `positive`, `negative` and `convert` options. The `suffix` changes text of available options, the `positive` specifies display string for successful answer and `negative` changes display string for negative answer. The final value is a boolean provided the `convert` option evaluates to boolean.
|
418
|
+
|
419
|
+
It's enough to provide the `suffix` option for the prompt to accept matching answers with correct labels:
|
354
420
|
|
355
421
|
```ruby
|
356
|
-
prompt.
|
422
|
+
prompt.yes?("Are you a human?") do |q|
|
423
|
+
q.suffix 'Yup/nope'
|
424
|
+
end
|
425
|
+
# =>
|
426
|
+
# Are you a human? (Yup/nope)
|
357
427
|
```
|
358
428
|
|
359
|
-
|
429
|
+
Alternatively, instead of `suffix` option provide the `positive` and `negative` labels:
|
430
|
+
|
431
|
+
```ruby
|
432
|
+
prompt.yes?("Are you a human?") do |q|
|
433
|
+
q.default false
|
434
|
+
q.positive 'Yup'
|
435
|
+
q.negative 'Nope'
|
436
|
+
end
|
437
|
+
# =>
|
438
|
+
# Are you a human? (yup/Nope)
|
439
|
+
```
|
440
|
+
|
441
|
+
Finally, providing all available options you can ask fully customized question:
|
442
|
+
|
443
|
+
```ruby
|
444
|
+
prompt.yes?('Are you a human?') do |q|
|
445
|
+
q.suffix 'Agree/Disagree'
|
446
|
+
q.positive 'Agree'
|
447
|
+
q.negative 'Disagree'
|
448
|
+
q.convert -> (input) { !input.match(/^agree$/i).nil? }
|
449
|
+
end
|
450
|
+
# =>
|
451
|
+
# Are you a human? (Agree/Disagree)
|
452
|
+
```
|
453
|
+
|
454
|
+
There is also the opposite for asking confirmation of negative question:
|
360
455
|
|
361
456
|
```ruby
|
362
457
|
prompt.no?('Do you hate Ruby?')
|
@@ -364,6 +459,8 @@ prompt.no?('Do you hate Ruby?')
|
|
364
459
|
# Do you hate Ruby? (y/N)
|
365
460
|
```
|
366
461
|
|
462
|
+
Similarly to `yes?` method, you can supply the same options to customize the question.
|
463
|
+
|
367
464
|
### 2.7 select
|
368
465
|
|
369
466
|
For asking questions involving list of options use `select` method by passing the question and possible choices:
|
@@ -392,13 +489,13 @@ end
|
|
392
489
|
# Jax
|
393
490
|
```
|
394
491
|
|
395
|
-
By default the choice name is used as return value, but you can provide your custom values:
|
492
|
+
By default the choice name is used as return value, but you can provide your custom values including a `Proc` object:
|
396
493
|
|
397
494
|
```ruby
|
398
495
|
prompt.select("Choose your destiny?") do |menu|
|
399
496
|
menu.choice 'Scorpion', 1
|
400
497
|
menu.choice 'Kano', 2
|
401
|
-
menu.choice 'Jax',
|
498
|
+
menu.choice 'Jax', -> { 'Nice choice captain!' }
|
402
499
|
end
|
403
500
|
# =>
|
404
501
|
# Choose your destiny? (Use arrow keys, press Enter to select)
|
@@ -448,14 +545,14 @@ end
|
|
448
545
|
# ‣ 3. Jax
|
449
546
|
```
|
450
547
|
|
451
|
-
You can configure help message
|
548
|
+
You can configure help message and/or marker like so
|
452
549
|
|
453
550
|
```ruby
|
454
551
|
choices = %w(Scorpion Kano Jax)
|
455
|
-
prompt.select("Choose your destiny?", choices, help: "(Bash keyboard)")
|
552
|
+
prompt.select("Choose your destiny?", choices, help: "(Bash keyboard)", marker: '>')
|
456
553
|
# =>
|
457
554
|
# Choose your destiny? (Bash keyboard)
|
458
|
-
#
|
555
|
+
# > Scorpion
|
459
556
|
# Kano
|
460
557
|
# Jax
|
461
558
|
```
|
@@ -547,6 +644,20 @@ And when you press enter you will see the following selected:
|
|
547
644
|
# => [{score: 20}, {score: 50}]
|
548
645
|
```
|
549
646
|
|
647
|
+
You can configure help message and/or marker like so
|
648
|
+
|
649
|
+
```ruby
|
650
|
+
choices = {vodka: 1, beer: 2, wine: 3, whisky: 4, bourbon: 5}
|
651
|
+
prompt.select("Select drinks?", choices, help: 'Press beer can against keyboard')
|
652
|
+
# =>
|
653
|
+
# Select drinks? (Press beer can against keyboard)"
|
654
|
+
# ‣ ⬡ vodka
|
655
|
+
# ⬡ beer
|
656
|
+
# ⬡ wine
|
657
|
+
# ⬡ whisky
|
658
|
+
# ⬡ bourbon
|
659
|
+
```
|
660
|
+
|
550
661
|
### 2.9 enum_select
|
551
662
|
|
552
663
|
In order to ask for standard selection from indexed list you can use `enum_select` and pass question together with possible choices:
|
@@ -606,7 +717,93 @@ end
|
|
606
717
|
# Select an editor? /usr/bin/vim
|
607
718
|
```
|
608
719
|
|
609
|
-
### 2.10
|
720
|
+
### 2.10 expand
|
721
|
+
|
722
|
+
The `expand` provides a compact way to ask a question with many options.
|
723
|
+
|
724
|
+
As first argument `expand` takes the message to display and as a second an array of choices. Compared to the `select`, `multi_select` and `enum_select`, the choices need to be objects that include `:key`, `:name` and `:value` keys. The `:key` must be a single character. The help choice is added automatically as the last option and the key `h`.
|
725
|
+
|
726
|
+
```ruby
|
727
|
+
choices = [
|
728
|
+
{
|
729
|
+
key: 'y',
|
730
|
+
name: 'overwrite this file',
|
731
|
+
value: :yes
|
732
|
+
}, {
|
733
|
+
key: 'n',
|
734
|
+
name: 'do not overwrite this file',
|
735
|
+
value: :no
|
736
|
+
}, {
|
737
|
+
key: 'q',
|
738
|
+
name: 'quit; do not overwrite this file ',
|
739
|
+
value: :quit
|
740
|
+
}
|
741
|
+
]
|
742
|
+
```
|
743
|
+
|
744
|
+
The choices can also be provided through DSL using the `choice` method. The `:value` can be a primitive value or `Proc` instance that gets executed and whose value is used as returned type. For example:
|
745
|
+
|
746
|
+
```ruby
|
747
|
+
prompt.expand('Overwrite Gemfile?') do |q|
|
748
|
+
q.choice key: 'y', name: 'Overwrite' do :ok end
|
749
|
+
q.choice key: 'n', name: 'Skip', value: :no
|
750
|
+
q.choice key: 'a', name: 'Overwrite all', value: :all
|
751
|
+
q.choice key: 'd', name: 'Show diff', value: :diff
|
752
|
+
q.choice key: 'q', name: 'Quit', value: :quit
|
753
|
+
end
|
754
|
+
```
|
755
|
+
|
756
|
+
The first element in the array of choices or provided via `choice` DSL will be the default choice, you can change that by passing `default` option.
|
757
|
+
|
758
|
+
```ruby
|
759
|
+
prompt.expand('Overwrite Gemfile?', choices)
|
760
|
+
# =>
|
761
|
+
# Overwrite Gemfile? (enter "h" for help) [y,n,q,h]
|
762
|
+
```
|
763
|
+
|
764
|
+
Each time user types an option a hint will be displayed:
|
765
|
+
|
766
|
+
```ruby
|
767
|
+
# Overwrite Gemfile? (enter "h" for help) [y,n,a,d,q,h] y
|
768
|
+
# >> overwrite this file
|
769
|
+
```
|
770
|
+
|
771
|
+
If user types `h` and presses enter, an expanded view will be shown which further allows to refine the choice:
|
772
|
+
|
773
|
+
```ruby
|
774
|
+
# Overwrite Gemfile?
|
775
|
+
# y - overwrite this file
|
776
|
+
# n - do not overwrite this file
|
777
|
+
# q - quit; do not overwrite this file
|
778
|
+
# h - print help
|
779
|
+
# Choice [y]:
|
780
|
+
```
|
781
|
+
|
782
|
+
Run `examples/expand.rb` to see the prompt in action.
|
783
|
+
|
784
|
+
### 2.11 collect
|
785
|
+
|
786
|
+
In order to collect more than one answer use `collect` method. Using the `key` you can describe the answers key name. All the methods for asking user input such as `ask`, `mask`, `select` can be directly invoked on the key. The key composition is very flexible by allowing nested keys. If you want the value to be automatically converted to required type use [convert](#221-convert).
|
787
|
+
|
788
|
+
For example to gather some contact information do:
|
789
|
+
|
790
|
+
```ruby
|
791
|
+
prompt.collect do
|
792
|
+
key(:name).ask('Name?')
|
793
|
+
|
794
|
+
key(:age).ask('Age?', convert: :int)
|
795
|
+
|
796
|
+
key(:address) do
|
797
|
+
key(:street).ask('Street?', required: true)
|
798
|
+
key(:city).ask('City?')
|
799
|
+
key(:zip).ask('Zip?', validate: /\A\d{3}\Z/)
|
800
|
+
end
|
801
|
+
end
|
802
|
+
# =>
|
803
|
+
# {:name => "Piotr", :age => 30, :address => {:street => "Street", :city => "City", :zip => "123"}}
|
804
|
+
```
|
805
|
+
|
806
|
+
### 2.12 suggest
|
610
807
|
|
611
808
|
To suggest possible matches for the user input use `suggest` method like so:
|
612
809
|
|
@@ -628,7 +825,7 @@ prompt.suggest('b', possible, indent: 4, single_text: 'Perhaps you meant?')
|
|
628
825
|
# blame
|
629
826
|
```
|
630
827
|
|
631
|
-
### 2.
|
828
|
+
### 2.13 slider
|
632
829
|
|
633
830
|
If you have constrained range of numbers for user to choose from you may consider using `slider`. The slider provides easy visual way of picking a value marked by `O` marker.
|
634
831
|
|
@@ -655,7 +852,7 @@ end
|
|
655
852
|
# |--O-------| 4
|
656
853
|
```
|
657
854
|
|
658
|
-
### 2.
|
855
|
+
### 2.14 say
|
659
856
|
|
660
857
|
To simply print message out to stdout use `say` like so:
|
661
858
|
|
@@ -663,11 +860,11 @@ To simply print message out to stdout use `say` like so:
|
|
663
860
|
prompt.say(...)
|
664
861
|
```
|
665
862
|
|
666
|
-
The `say` method also accepts option `:color` which supports all the colors provided by [pastel](https://github.com/
|
863
|
+
The `say` method also accepts option `:color` which supports all the colors provided by [pastel](https://github.com/piotrmurach/pastel#3-supported-colors)
|
667
864
|
|
668
865
|
**TTY::Prompt** provides more specific versions of `say` method to better express intenation behind the message such as `ok`, `warn` and `error`.
|
669
866
|
|
670
|
-
### 2.
|
867
|
+
### 2.15 ok
|
671
868
|
|
672
869
|
Print message(s) in green do:
|
673
870
|
|
@@ -675,7 +872,7 @@ Print message(s) in green do:
|
|
675
872
|
prompt.ok(...)
|
676
873
|
```
|
677
874
|
|
678
|
-
### 2.
|
875
|
+
### 2.16 warn
|
679
876
|
|
680
877
|
Print message(s) in yellow do:
|
681
878
|
|
@@ -683,7 +880,7 @@ Print message(s) in yellow do:
|
|
683
880
|
prompt.warn(...)
|
684
881
|
```
|
685
882
|
|
686
|
-
### 2.
|
883
|
+
### 2.17 error
|
687
884
|
|
688
885
|
Print message(s) in red do:
|
689
886
|
|
@@ -693,7 +890,7 @@ prompt.error(...)
|
|
693
890
|
|
694
891
|
## Contributing
|
695
892
|
|
696
|
-
1. Fork it ( https://github.com/
|
893
|
+
1. Fork it ( https://github.com/piotrmurach/tty-prompt/fork )
|
697
894
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
698
895
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
699
896
|
4. Push to the branch (`git push origin my-new-feature`)
|