cl 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cl/opt.rb +3 -4
- data/lib/cl/parser.rb +7 -11
- data/lib/cl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54b800fbadeb907af1b519de5fdcf782e368c493
|
4
|
+
data.tar.gz: f7901ca63ad3a15cad81831c932dac59be139fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d25a93f2eb87df5d1146a86375d1f804f469eadfb22af140ae52df1a531f1ace7a4381f49705f38d82e1bfe69016e14f6e2f5db4f9c151e3881f8c0464d9264f
|
7
|
+
data.tar.gz: 56f2c95bccd01fa76d4502a9c2d22fabfc1612cc9c01f0502b67691d4927c64b08d58d6ff98f1318aa315c4078bf624cfc45be4f33735f6476641075b2acb868
|
data/Gemfile.lock
CHANGED
data/lib/cl/opt.rb
CHANGED
@@ -15,7 +15,7 @@ class Cl
|
|
15
15
|
|
16
16
|
def initialize(*)
|
17
17
|
super
|
18
|
-
noize(strs) if type == :flag
|
18
|
+
noize!(strs) if type == :flag
|
19
19
|
end
|
20
20
|
|
21
21
|
def define(const)
|
@@ -64,7 +64,6 @@ class Cl
|
|
64
64
|
def deprecated
|
65
65
|
return [name, opts[:deprecated]] unless opts[:deprecated].is_a?(Symbol)
|
66
66
|
[opts[:deprecated], name] if opts[:deprecated]
|
67
|
-
# [name, opts[:deprecated]] if opts[:deprecated]
|
68
67
|
end
|
69
68
|
|
70
69
|
def downcase?
|
@@ -183,10 +182,10 @@ class Cl
|
|
183
182
|
end
|
184
183
|
end
|
185
184
|
|
186
|
-
def noize(strs)
|
185
|
+
def noize!(strs)
|
187
186
|
strs = strs.select { |str| str.start_with?('--') }
|
188
187
|
strs = strs.reject { |str| str.include?('[no-]') }
|
189
|
-
strs.each { |str| str.replace(str.sub('--', '--[no-]')) }
|
188
|
+
strs.each { |str| str.replace(str.sub('--', '--[no-]')) unless str == '--help' }
|
190
189
|
end
|
191
190
|
end
|
192
191
|
end
|
data/lib/cl/parser.rb
CHANGED
@@ -9,7 +9,7 @@ class Cl
|
|
9
9
|
|
10
10
|
super do
|
11
11
|
opts.each do |opt|
|
12
|
-
on(*
|
12
|
+
on(*dasherize(opt.strs)) do |value|
|
13
13
|
set(opt, value)
|
14
14
|
end
|
15
15
|
|
@@ -21,7 +21,7 @@ class Cl
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
dasherize!(args)
|
25
25
|
parse!(args)
|
26
26
|
end
|
27
27
|
|
@@ -37,16 +37,12 @@ class Cl
|
|
37
37
|
instance_exec(*args, &opt.block)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
PATTERN = /^(-{1,2})(\[?no-\]?)?(.*)$/
|
40
|
+
def dasherize(strs)
|
41
|
+
strs.map { |str| str.gsub('_', '-') }
|
42
|
+
end
|
45
43
|
|
46
|
-
def
|
47
|
-
|
48
|
-
strs.each { |str| str.gsub!(PATTERN) { "#{$1}#{$2}#{$3.tr('-', '_')}" } }
|
49
|
-
strs.each { |str| str.gsub!(/^--no_/, '--no-') } # ruby < 2.4
|
44
|
+
def dasherize!(strs)
|
45
|
+
strs.replace(dasherize(strs))
|
50
46
|
end
|
51
47
|
end
|
52
48
|
end
|
data/lib/cl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: regstry
|