commander-openflighthpc 2.0.0 → 2.0.1

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
  SHA256:
3
- metadata.gz: 2f44f3e008d2afe4767d93545e1f96bee55eb972e1b8558f6ed214bf18290079
4
- data.tar.gz: fc44c6aa1a350fe8be8d8ea1a79cd3841dc82b59fb5fab14040f4eaac2e199cd
3
+ metadata.gz: 3febc8843b2d974230cdb5b51f165e65cb268e2b42e193acbbb8de5bef54e107
4
+ data.tar.gz: eb05690fcc2789518b3bcb78720d863fcab1447ed38677022f86802f0d7a579c
5
5
  SHA512:
6
- metadata.gz: 2b9a7db7d0cc5f8b08c8e2d894ace171c8a7d8527142c8117eb1705fc563d9504d92ddbe6abb56abc94526a9d2a3fb11f226191aa1f629a9a72a42bd95bc8c98
7
- data.tar.gz: 55004b7e9ff3f42cbdc5a5d99281d24f9eb88f441bfbc8465fe2ea8792fc817ec8c06ada2a2f0dd66f6820264507fda8ff575941b265faacefa7ab2be32b96e0
6
+ metadata.gz: 4090ea8ea6a812911cf32fbe3a018a422abc3c8ca72117c09ff1583d114529fa61bde7681e979a6bd7c1a793a7766531e15ff18877dc323f28b7f5e7dd0d10fc
7
+ data.tar.gz: 3327644d36fba11879f83b62468d2ebb3dd9e35ef24c2996878eaa63347c099104860f8498cbc84d8bde3aefdccbcdb912956d6fe459ff9e91038fc4b40a8783
@@ -2,7 +2,6 @@ require 'optparse'
2
2
  require 'commander/patches/implicit-short-tags'
3
3
  require 'commander/patches/decimal-integer'
4
4
  require 'commander/patches/validate_inputs'
5
- require 'commander/patches/option_defaults'
6
5
  require 'commander/patches/help_formatter_binding'
7
6
  require 'commander/patches/priority_sort'
8
7
 
@@ -122,17 +121,15 @@ module Commander
122
121
  # c.option '--date [DATE]', Date
123
122
  #
124
123
 
125
- # NOTE: This method is being patched to handle defaults differently
126
- prepend Patches::OptionDefaults
127
- def option(*args, &block)
124
+ def option(*args, default: nil, &block)
128
125
  switches, description = Runner.separate_switches_from_description(*args)
129
126
  proc = block || option_proc(switches)
130
127
  @options << {
131
128
  args: args,
132
129
  proc: proc,
133
130
  switches: switches,
134
- description: description,
135
- }
131
+ description: description
132
+ }.tap { |o| o[:default] = default unless default.nil? }
136
133
  end
137
134
 
138
135
  ##
@@ -1,3 +1,3 @@
1
1
  module Commander
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commander-openflighthpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alces Flight Ltd
@@ -140,7 +140,6 @@ files:
140
140
  - lib/commander/patches/decimal-integer.rb
141
141
  - lib/commander/patches/help_formatter_binding.rb
142
142
  - lib/commander/patches/implicit-short-tags.rb
143
- - lib/commander/patches/option_defaults.rb
144
143
  - lib/commander/patches/priority_sort.rb
145
144
  - lib/commander/patches/validate_inputs.rb
146
145
  - lib/commander/platform.rb
@@ -1,23 +0,0 @@
1
- module Commander
2
- module Patches
3
- module OptionDefaults
4
- # I can't remember what this patch does, but I found it in the code
5
- # base. It is better if this magic is kept separate
6
- def option(*args, &block)
7
- default = nil
8
- args.delete_if do |v|
9
- if v.is_a?(Hash) && v.key?(:default)
10
- default = v[:default]
11
- true
12
- else
13
- false
14
- end
15
- end
16
- opt = super
17
- opt.tap do |h|
18
- h.merge!( { default: default } ) unless default.nil?
19
- end
20
- end
21
- end
22
- end
23
- end