samovar 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/samovar/command.rb +10 -10
- data/lib/samovar/options.rb +4 -4
- data/lib/samovar/output/rows.rb +2 -2
- data/lib/samovar/version.rb +1 -1
- data/spec/samovar/command_spec.rb +2 -2
- data/spec/samovar/table_spec.rb +1 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecb004ddf75498e8cbf4e018680b600b5d443b1fe4ab1c4fac1b9ffffa3536be
|
4
|
+
data.tar.gz: 2f1ccc87b5fb268e7c0caa14d3eb8d6d9bf57b0ba83958a3949673989cc67468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bc2b0369414705c978012ca126a3f24cd40ba3664a62a1a2a8bed8c1881cf741265af4d90fbf32f0b36c3ede0928627253e7ed7ab056d1548c8b291d029f262
|
7
|
+
data.tar.gz: b1addcb523946960d7d6b399b518af2c6e7dfd91f7128fad75d3ec818f7552e57f8bcac0f2641237d051c232bb8de632bd4f1d02ff75d9dfa8b014e44096512c
|
data/lib/samovar/command.rb
CHANGED
@@ -66,24 +66,24 @@ module Samovar
|
|
66
66
|
self.table << row
|
67
67
|
end
|
68
68
|
|
69
|
-
def self.options(*
|
70
|
-
append Options.parse(*
|
69
|
+
def self.options(*arguments, **options, &block)
|
70
|
+
append Options.parse(*arguments, **options, &block)
|
71
71
|
end
|
72
72
|
|
73
|
-
def self.nested(*
|
74
|
-
append Nested.new(*
|
73
|
+
def self.nested(*arguments, **options)
|
74
|
+
append Nested.new(*arguments, **options)
|
75
75
|
end
|
76
76
|
|
77
|
-
def self.one(*
|
78
|
-
append One.new(*
|
77
|
+
def self.one(*arguments, **options)
|
78
|
+
append One.new(*arguments, **options)
|
79
79
|
end
|
80
80
|
|
81
|
-
def self.many(*
|
82
|
-
append Many.new(*
|
81
|
+
def self.many(*arguments, **options)
|
82
|
+
append Many.new(*arguments, **options)
|
83
83
|
end
|
84
84
|
|
85
|
-
def self.split(*
|
86
|
-
append Split.new(*
|
85
|
+
def self.split(*arguments, **options)
|
86
|
+
append Split.new(*arguments, **options)
|
87
87
|
end
|
88
88
|
|
89
89
|
def self.usage(rows, name)
|
data/lib/samovar/options.rb
CHANGED
@@ -22,8 +22,8 @@ require_relative 'option'
|
|
22
22
|
|
23
23
|
module Samovar
|
24
24
|
class Options
|
25
|
-
def self.parse(*
|
26
|
-
options = self.new(*
|
25
|
+
def self.parse(*arguments, **options, &block)
|
26
|
+
options = self.new(*arguments, **options)
|
27
27
|
|
28
28
|
options.instance_eval(&block) if block_given?
|
29
29
|
|
@@ -76,8 +76,8 @@ module Samovar
|
|
76
76
|
@ordered.empty?
|
77
77
|
end
|
78
78
|
|
79
|
-
def option(*
|
80
|
-
self << Option.new(*
|
79
|
+
def option(*arguments, **options, &block)
|
80
|
+
self << Option.new(*arguments, **options, &block)
|
81
81
|
end
|
82
82
|
|
83
83
|
def merge!(options)
|
data/lib/samovar/output/rows.rb
CHANGED
data/lib/samovar/version.rb
CHANGED
@@ -47,8 +47,8 @@ module Samovar::CommandSpec
|
|
47
47
|
|
48
48
|
RSpec.describe Samovar::Command do
|
49
49
|
it "should invoke call" do
|
50
|
-
expect(Top).to receive(:new).and_wrap_original do |original_method, *
|
51
|
-
original_method.call(*
|
50
|
+
expect(Top).to receive(:new).and_wrap_original do |original_method, *arguments, &block|
|
51
|
+
original_method.call(*arguments, &block).tap do |instance|
|
52
52
|
expect(instance).to receive(:call)
|
53
53
|
end
|
54
54
|
end
|
data/spec/samovar/table_spec.rb
CHANGED
@@ -28,7 +28,7 @@ RSpec.describe Samovar::Table do
|
|
28
28
|
it "can merge options" do
|
29
29
|
parent << Samovar::Options.parse
|
30
30
|
subject << Samovar::Options.parse do
|
31
|
-
option "--help"
|
31
|
+
option "--help", "Print help information."
|
32
32
|
end
|
33
33
|
|
34
34
|
subject.merged
|
@@ -36,5 +36,4 @@ RSpec.describe Samovar::Table do
|
|
36
36
|
|
37
37
|
expect(parent[:options]).to be_empty
|
38
38
|
end
|
39
|
-
|
40
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samovar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mapping
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
|
-
rubygems_version: 3.0.
|
159
|
+
rubygems_version: 3.0.4
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: Samovar is a flexible option parser excellent support for sub-commands and
|