baf 0.1.1 → 0.2.0

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: 1991efb68636435cda379110ba0131f4215c43d0
4
- data.tar.gz: b72d0e15f29acddc4644a4d93d1cf47a25c06cc7
3
+ metadata.gz: 150c3cca7fba34de369d231d80ac5d40570b788e
4
+ data.tar.gz: eae88fb291406234386f09da17458982395d4af3
5
5
  SHA512:
6
- metadata.gz: cfbd178801b266b25d26c04cfff28ddb1a9df4eed78aff69716583fab76d8c5236447eef3f260c7ae4237d5e7e55c5178bdd458c7714950f305b80cf442447da
7
- data.tar.gz: b972cc8676106807bd668ece76a2ffd8190129d66ff6104c52462676f07c014a36d23488e9e07b39b5ed2471036a7ef60da02fad54c789a5d4c8b7762fde7aae
6
+ metadata.gz: acf3c301be34c11193d54e90234ce1cfba6420ac1ed8f721ac032fa7a47d342f41978df191c3f9283329e1f2a420c51786b3c80d24cd304973db3a30d343de32
7
+ data.tar.gz: e5993ca64496e85ee17ebb676a1a996348afa12b5da7201c7b471cce4f2bbda5f9bbb6f86363bd5fb7f56425e012c38daa077fffb772660b6f0f91b212c1d0dc
@@ -55,7 +55,7 @@ module Baf
55
55
  end
56
56
 
57
57
  def flag_version version
58
- flag :V, 'version', -> env { env.puts version }
58
+ flag :V, 'version', 'print version', -> env { env.puts version }
59
59
  end
60
60
 
61
61
  def option *args
@@ -13,16 +13,23 @@ module Baf
13
13
 
14
14
  protected
15
15
 
16
- def build_attrs(short, long, arg_or_block = nil, desc = nil)
16
+ def build_attrs(short, long, arg_or_desc = nil, desc_or_block = nil)
17
17
  {
18
18
  short: short,
19
- long: long,
20
- desc: desc
21
- }.tap do |attrs|
22
- case arg_or_block
23
- when Proc then attrs[:block] = arg_or_block
24
- when String then attrs[:arg] = arg_or_block
25
- end
19
+ long: long
20
+ }.merge case desc_or_block
21
+ when Proc
22
+ {
23
+ desc: arg_or_desc,
24
+ block: desc_or_block
25
+ }
26
+ when String
27
+ {
28
+ arg: arg_or_desc,
29
+ desc: desc_or_block
30
+ }
31
+ else
32
+ {}
26
33
  end
27
34
  end
28
35
 
@@ -30,7 +37,7 @@ module Baf
30
37
  [
31
38
  '--' + long.to_s.tr(?_, ?-),
32
39
  arg
33
- ].join ' '
40
+ ].compact.join ' '
34
41
  end
35
42
  end
36
43
  end
@@ -1,3 +1,3 @@
1
1
  module Baf
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: baf-testing