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 +4 -4
- data/lib/commander/command.rb +3 -6
- data/lib/commander/version.rb +1 -1
- metadata +1 -2
- data/lib/commander/patches/option_defaults.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3febc8843b2d974230cdb5b51f165e65cb268e2b42e193acbbb8de5bef54e107
|
4
|
+
data.tar.gz: eb05690fcc2789518b3bcb78720d863fcab1447ed38677022f86802f0d7a579c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4090ea8ea6a812911cf32fbe3a018a422abc3c8ca72117c09ff1583d114529fa61bde7681e979a6bd7c1a793a7766531e15ff18877dc323f28b7f5e7dd0d10fc
|
7
|
+
data.tar.gz: 3327644d36fba11879f83b62468d2ebb3dd9e35ef24c2996878eaa63347c099104860f8498cbc84d8bde3aefdccbcdb912956d6fe459ff9e91038fc4b40a8783
|
data/lib/commander/command.rb
CHANGED
@@ -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
|
-
|
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
|
##
|
data/lib/commander/version.rb
CHANGED
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.
|
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
|