cli_miami 0.0.6 → 0.0.7
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/.gitignore +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +19 -0
- data/README.md +14 -2
- data/lib/cli_miami/ask.rb +7 -2
- data/lib/namespaced.rb +3 -6
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa50511e25723fc7ca8fbdec47e34dfc7dda118
|
4
|
+
data.tar.gz: a44662dc8d2a3f75d4734bd14f1cc0de6367cc0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dd5ea9264adc62e6ae4eb032ef37697ae2d5b79cd6aa3a48aee881dc77a53c660f85eb4f2fc3c2a01ea1e39a05e738ffd044b102954ed3499db806a902b1edb
|
7
|
+
data.tar.gz: f50b149cef566a8611d6c44b277385cc9fa234bff335309f4952f00f5f3b9dae7caa0966fab2519117aaacf1fd2b13bb761f4232082a59acd1d56ce9dd8fd35a
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -4,7 +4,14 @@ GEM
|
|
4
4
|
celluloid (0.16.0)
|
5
5
|
timers (~> 4.0.0)
|
6
6
|
coderay (1.1.0)
|
7
|
+
coveralls (0.7.1)
|
8
|
+
multi_json (~> 1.3)
|
9
|
+
rest-client
|
10
|
+
simplecov (>= 0.7)
|
11
|
+
term-ansicolor
|
12
|
+
thor
|
7
13
|
diff-lcs (1.2.5)
|
14
|
+
docile (1.1.5)
|
8
15
|
ffi (1.9.6)
|
9
16
|
formatador (0.2.5)
|
10
17
|
guard (2.10.5)
|
@@ -26,7 +33,10 @@ GEM
|
|
26
33
|
rb-inotify (>= 0.9)
|
27
34
|
lumberjack (1.0.9)
|
28
35
|
method_source (0.8.2)
|
36
|
+
mime-types (2.4.3)
|
37
|
+
multi_json (1.10.1)
|
29
38
|
nenv (0.1.1)
|
39
|
+
netrc (0.10.2)
|
30
40
|
pry (0.10.1)
|
31
41
|
coderay (~> 1.1.0)
|
32
42
|
method_source (~> 0.8.1)
|
@@ -34,6 +44,9 @@ GEM
|
|
34
44
|
rb-fsevent (0.9.4)
|
35
45
|
rb-inotify (0.9.5)
|
36
46
|
ffi (>= 0.5.0)
|
47
|
+
rest-client (1.7.2)
|
48
|
+
mime-types (>= 1.16, < 3.0)
|
49
|
+
netrc (~> 0.7)
|
37
50
|
rspec (3.1.0)
|
38
51
|
rspec-core (~> 3.1.0)
|
39
52
|
rspec-expectations (~> 3.1.0)
|
@@ -46,6 +59,11 @@ GEM
|
|
46
59
|
rspec-mocks (3.1.3)
|
47
60
|
rspec-support (~> 3.1.0)
|
48
61
|
rspec-support (3.1.2)
|
62
|
+
simplecov (0.9.1)
|
63
|
+
docile (~> 1.1.0)
|
64
|
+
multi_json (~> 1.0)
|
65
|
+
simplecov-html (~> 0.8.0)
|
66
|
+
simplecov-html (0.8.0)
|
49
67
|
slop (3.6.0)
|
50
68
|
term-ansicolor (1.3.0)
|
51
69
|
tins (~> 1.0)
|
@@ -59,6 +77,7 @@ PLATFORMS
|
|
59
77
|
ruby
|
60
78
|
|
61
79
|
DEPENDENCIES
|
80
|
+
coveralls
|
62
81
|
guard (~> 2.6)
|
63
82
|
guard-rspec (~> 4.3)
|
64
83
|
rspec (~> 3.1)
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](http://badge.fury.io/rb/cli_miami)
|
2
2
|
[](https://travis-ci.org/brewster1134/CLI-Miami)
|
3
|
+
[](https://coveralls.io/r/brewster1134/CLI-Miami)
|
3
4
|
|
4
5
|
# CLI Miami
|
5
6
|
A feature rich alternative for `gets` and `puts` for your cli interface
|
@@ -25,6 +26,19 @@ _* see supported options below_
|
|
25
26
|
S.ay 'Hello World', :color => :red
|
26
27
|
```
|
27
28
|
|
29
|
+
Sometimes you want to have multiple styles on a single line. There are 2 ways to do this.
|
30
|
+
|
31
|
+
The multi-line way using `:newline => false`
|
32
|
+
```ruby
|
33
|
+
S.ay 'Hello ', :color => :red, :newline => false
|
34
|
+
S.ay 'World', :color => :blue
|
35
|
+
```
|
36
|
+
|
37
|
+
Or on a single line using ANSI codes as methods. *All the ANSI color and style codes listed below can be used*
|
38
|
+
```ruby
|
39
|
+
S.ay "#{'Hello'.red} #{'World'.blue}"
|
40
|
+
```
|
41
|
+
|
28
42
|
#### A.sk
|
29
43
|
`A.sk` accepts the same arguments as `S.say`, with additional support for a block that passes the users response
|
30
44
|
|
@@ -37,8 +51,6 @@ end
|
|
37
51
|
#### Options
|
38
52
|
Both `S.ay` and `A.sk` suport the same options
|
39
53
|
|
40
|
-
https://github.com/flori/term-ansicolor/tree/master/lib/term/ansicolor/attribute
|
41
|
-
|
42
54
|
```ruby
|
43
55
|
color: => [symbol] # See ansi color codes below
|
44
56
|
bgcolor: => [symbol] # See ansi color codes below
|
data/lib/cli_miami/ask.rb
CHANGED
@@ -13,7 +13,7 @@ class CliMiami::A
|
|
13
13
|
def self.sk question, options = {}, &block
|
14
14
|
# set default options
|
15
15
|
@options = {
|
16
|
-
:readline => false
|
16
|
+
:readline => false
|
17
17
|
}
|
18
18
|
|
19
19
|
# merge preset options
|
@@ -37,7 +37,12 @@ class CliMiami::A
|
|
37
37
|
$stdin.gets
|
38
38
|
end.rstrip
|
39
39
|
|
40
|
-
|
40
|
+
# return response if no block is passed
|
41
|
+
if block
|
42
|
+
yield output
|
43
|
+
else
|
44
|
+
return output
|
45
|
+
end
|
41
46
|
end
|
42
47
|
|
43
48
|
private
|
data/lib/namespaced.rb
CHANGED
@@ -7,16 +7,13 @@ class CliMiami
|
|
7
7
|
# default presets
|
8
8
|
@@presets = {
|
9
9
|
:fail => {
|
10
|
-
:color => :red
|
11
|
-
:style => :bold
|
10
|
+
:color => :red
|
12
11
|
},
|
13
12
|
:warn => {
|
14
|
-
:color => :yellow
|
15
|
-
:style => :bold
|
13
|
+
:color => :yellow
|
16
14
|
},
|
17
15
|
:success => {
|
18
|
-
:color => :green
|
19
|
-
:style => :bold
|
16
|
+
:color => :green
|
20
17
|
}
|
21
18
|
}
|
22
19
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cli_miami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brewster
|
@@ -118,9 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.4.5
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: A feature rich alternative for `gets` and `puts` for your cli interface
|
125
125
|
test_files: []
|
126
|
-
has_rdoc:
|