cl 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af6796a209dc36a6858d28570150728e43254ce2
4
- data.tar.gz: 3b46ed2c8f04287ffc8effb5d050f60deb2fd360
3
+ metadata.gz: 97d0963fc5570530e792aadfb50e842df447958c
4
+ data.tar.gz: 8b56cc03437ea8256189b989064ee6362d1c1f69
5
5
  SHA512:
6
- metadata.gz: f38f23ae73bd95b116154be8b5b0a0971ac38260883132b0c229f0ba574c53b99ad2232e0767b593ce9d54ccbd41be0df437329f675067979043befe10583de4
7
- data.tar.gz: 77dac679a5da561cf9315f8f5fa0313584d6ae5969e856e38326820204add52859c4918daf2d4f193af4ebee0cc85800fc263ef98ded8ea38943fff24e6228a8
6
+ metadata.gz: a5a3938fe294a6b21a36c0ecf35691d7a597188083d3c31fc5423547b833b3415aea4535d131c870c9f5e8b4c5748dcf60755a9c23ee6018bac5452333b0fe92
7
+ data.tar.gz: ee6055bea2cd43fa21f413c35163016d0e3ce3690eb656be7cd70c334a3c6002d355050d43411eebea1dea19832bdea09ce87f794020813d247841ffdc176a4f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cl (0.1.19)
4
+ cl (0.1.20)
5
5
  regstry (~> 1.0.3)
6
6
 
7
7
  GEM
data/lib/cl/parser.rb CHANGED
@@ -9,25 +9,26 @@ class Cl
9
9
 
10
10
  super do
11
11
  opts.each do |opt|
12
- on(*dasherize(opt.strs)) do |value|
12
+ on(*dasherize(*opt.strs)) do |value|
13
13
  set(opt, value)
14
14
  end
15
15
 
16
16
  opt.aliases.each do |name|
17
- on(aliased(opt, name)) do |value|
17
+ on(*dasherize(aliased(opt, name))) do |value|
18
18
  @opts[name] = set(opt, value)
19
19
  end
20
20
  end
21
21
  end
22
22
  end
23
23
 
24
- dasherize!(args)
24
+ args.replace(dasherize(*args))
25
25
  parse!(args)
26
26
  end
27
27
 
28
28
  def aliased(opt, name)
29
29
  str = opt.strs.detect { |str| str.start_with?('--') } || raise
30
- str.sub(opt.name.to_s, name.to_s)
30
+ str = str.sub(opt.name.to_s, name.to_s)
31
+ str.sub(opt.name.to_s.gsub('_', '-'), name.to_s)
31
32
  end
32
33
 
33
34
  # should consider negative arities (e.g. |one, *two|)
@@ -37,12 +38,8 @@ class Cl
37
38
  instance_exec(*args, &opt.block)
38
39
  end
39
40
 
40
- def dasherize(strs)
41
+ def dasherize(*strs)
41
42
  strs.map { |str| str.start_with?('--') ? str.gsub('_', '-') : str }
42
43
  end
43
-
44
- def dasherize!(strs)
45
- strs.replace(dasherize(strs))
46
- end
47
44
  end
48
45
  end
data/lib/cl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Cl
2
- VERSION = '0.1.20'
2
+ VERSION = '0.1.21'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs