cliswitch 0.2.1 → 0.3.0
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/lib/cliswitch.rb +25 -8
- 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: 2ac2df2809fefe3c68dcb610044a686868a93e4d6f9c02d4261b79f4604dd71c
|
|
4
|
+
data.tar.gz: 20261ed4fbc24010f195ff49961726841e92d2858334114b344aeb2ee544f814
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3cda1f5ba6ca766162c52c53f4482aa0883bc25564415447b8d9bb106b23fd9742cb7b46f298baf1fbf106c1b5f580d2fd32bc5d3d32408e9c83a5d6e514df2
|
|
7
|
+
data.tar.gz: 8b2e63bfa865c2b4bdf012a2f6deeb2956d3f91e30eee77b39167f1751bc2081127e7372d58cb9e526f62f0f61609646b06c8116e36c05a7b7bc6527fd075871
|
data/lib/cliswitch.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# File : cliswitch.rb
|
|
3
3
|
# Authors : ccmywish <ccmywish@qq.com>
|
|
4
4
|
# Created on : <2022-04-13>
|
|
5
|
-
# Last modified : <2022-04-
|
|
5
|
+
# Last modified : <2022-04-14>
|
|
6
6
|
#
|
|
7
7
|
# cliswitch:
|
|
8
8
|
#
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
class CliSwitch
|
|
14
14
|
|
|
15
|
-
VERSION = "0.
|
|
15
|
+
VERSION = "0.3.0"
|
|
16
16
|
|
|
17
17
|
class Option
|
|
18
18
|
attr_accessor :name,
|
|
@@ -53,14 +53,14 @@ class CliSwitch
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
# instance attribute
|
|
57
57
|
attr_accessor :args
|
|
58
58
|
attr_accessor :options
|
|
59
59
|
attr_accessor :options_config
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
def initialize
|
|
63
|
-
@options_config =
|
|
62
|
+
def initialize
|
|
63
|
+
@options_config = self.class.class_options_config
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
|
|
@@ -127,7 +127,8 @@ class CliSwitch
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
# Not validate by default, because it's not necessary
|
|
131
|
+
# validate_mandatory_options()
|
|
131
132
|
|
|
132
133
|
# Debug
|
|
133
134
|
# puts "=> args:"
|
|
@@ -140,6 +141,22 @@ class CliSwitch
|
|
|
140
141
|
end
|
|
141
142
|
|
|
142
143
|
|
|
144
|
+
#
|
|
145
|
+
# MyClass < CliSwitch
|
|
146
|
+
# option ...
|
|
147
|
+
# end
|
|
148
|
+
#
|
|
149
|
+
def self.option(...)
|
|
150
|
+
# A class instance variable for every subclass
|
|
151
|
+
@class_options_config ||= []
|
|
152
|
+
@class_options_config << Option.new(...)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def self.class_options_config
|
|
156
|
+
@class_options_config
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
|
|
143
160
|
private
|
|
144
161
|
|
|
145
162
|
|
|
@@ -172,9 +189,9 @@ class CliSwitch
|
|
|
172
189
|
end
|
|
173
190
|
end
|
|
174
191
|
|
|
175
|
-
end
|
|
192
|
+
end #end each loop
|
|
176
193
|
|
|
177
|
-
end
|
|
194
|
+
end # end def validate_mandatory_options
|
|
178
195
|
|
|
179
196
|
|
|
180
197
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cliswitch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ccmywish
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-04-
|
|
11
|
+
date: 2022-04-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: 'cliswitch: cli option parse.
|
|
14
14
|
|
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '0'
|
|
42
42
|
requirements: []
|
|
43
|
-
rubygems_version: 3.3.
|
|
43
|
+
rubygems_version: 3.3.11
|
|
44
44
|
signing_key:
|
|
45
45
|
specification_version: 4
|
|
46
46
|
summary: 'cliswitch: cli option parse'
|