prompter 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/prompter.rb +12 -1
- data/prompter.gemspec +1 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/prompter.rb
CHANGED
@@ -12,6 +12,7 @@ class Prompter
|
|
12
12
|
:say_echo_style => nil,
|
13
13
|
:say_notice_style => :yellow,
|
14
14
|
:say_warning_style => :red,
|
15
|
+
:say_title_style => [:cyan, :bold, :reversed],
|
15
16
|
:ask_style => :magenta,
|
16
17
|
:hint_style => :green }
|
17
18
|
|
@@ -88,6 +89,16 @@ class Prompter
|
|
88
89
|
say message, opts
|
89
90
|
end
|
90
91
|
|
92
|
+
# Shows a colored message. It adds a new line and a space before and after the message
|
93
|
+
# and uses :say passing the :say_title_style :style option
|
94
|
+
#
|
95
|
+
# @see #say
|
96
|
+
#
|
97
|
+
def say_title(message="", opts={})
|
98
|
+
opts = { :style => :say_title_style }.merge opts
|
99
|
+
say "\n #{message} \n", opts
|
100
|
+
end
|
101
|
+
|
91
102
|
# Asks for an input
|
92
103
|
#
|
93
104
|
# @param [String] prompt Your question
|
@@ -290,7 +301,7 @@ class Prompter
|
|
290
301
|
end
|
291
302
|
|
292
303
|
def list_choices(prompt, list, opts={}, many=false)
|
293
|
-
hint = many ? "[choose one or more in range 1..#{list.size} (#{opts[:split].nil? ? '<space>' : opts[:split].inspect}
|
304
|
+
hint = many ? "[choose one or more in range 1..#{list.size} (#{opts[:split].nil? ? '<space>' : opts[:split].inspect} separated)]" :
|
294
305
|
"[choose one in range 1..#{list.size}]"
|
295
306
|
opts = { :style => :ask_style,
|
296
307
|
:hint => hint }.merge opts
|
data/prompter.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: prompter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Domizio Demichelis
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-18 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -52,8 +52,8 @@ executables: []
|
|
52
52
|
|
53
53
|
extensions: []
|
54
54
|
|
55
|
-
extra_rdoc_files:
|
56
|
-
|
55
|
+
extra_rdoc_files:
|
56
|
+
- README.rdoc
|
57
57
|
files:
|
58
58
|
- .gitignore
|
59
59
|
- LICENSE
|