opt_parse_validator 0.0.15.1 → 0.0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58bdbf0b9c2bc56380fec56808903c0809c99720
|
4
|
+
data.tar.gz: 79eaa1f3db729626ea0054e9f75134b8f0593b6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b17d62e6fd525c9dab90460468a6686d87f862b7d3647888e3a88b2bd1ea153279bf9d4f25f8cf8ade8b266ad1381581027f2ec3302ee9926f00208c3e5f60b
|
7
|
+
data.tar.gz: '00780cbecf1ab1fbedfa168accc963d37ebbde70e0c71e4447802a7add91bcbe3c6ce73f2a59ab1fce608a9508a0c84f1024339b2acd6a02ec6ee1a8d06847f8'
|
@@ -25,12 +25,16 @@ module OptParseValidator
|
|
25
25
|
|
26
26
|
# @return [ Void ]
|
27
27
|
def append_help_messages
|
28
|
-
option << "Default: #{
|
28
|
+
option << "Default: #{help_message_for_default}" if default
|
29
29
|
option << "Value if no argument supplied: #{value_if_empty}" if value_if_empty
|
30
30
|
option << 'This option is mandatory' if required?
|
31
31
|
option << "This option is mandatory unless #{required_unless.join(' or ')} is/are supplied" unless required_unless.empty?
|
32
32
|
end
|
33
33
|
|
34
|
+
def help_message_for_default
|
35
|
+
default.to_s
|
36
|
+
end
|
37
|
+
|
34
38
|
# @return [ Boolean ]
|
35
39
|
def required?
|
36
40
|
@required ||= attrs[:required]
|
@@ -13,23 +13,6 @@ module OptParseValidator
|
|
13
13
|
super(option, attrs)
|
14
14
|
end
|
15
15
|
|
16
|
-
def default
|
17
|
-
return nil unless attrs[:default]
|
18
|
-
|
19
|
-
default = ''
|
20
|
-
|
21
|
-
attrs[:default].each do |key, value|
|
22
|
-
default << if value == true
|
23
|
-
key.to_s.titleize
|
24
|
-
else
|
25
|
-
"#{key.to_s.titleize}: #{value}"
|
26
|
-
end
|
27
|
-
default << ', '
|
28
|
-
end
|
29
|
-
|
30
|
-
default.chomp(', ')
|
31
|
-
end
|
32
|
-
|
33
16
|
def append_help_messages
|
34
17
|
option << 'Available Choices:'
|
35
18
|
|
@@ -53,6 +36,21 @@ module OptParseValidator
|
|
53
36
|
end
|
54
37
|
end
|
55
38
|
|
39
|
+
def help_message_for_default
|
40
|
+
msg = ''
|
41
|
+
|
42
|
+
default.each do |key, value|
|
43
|
+
msg << if value == true
|
44
|
+
key.to_s.titleize
|
45
|
+
else
|
46
|
+
"#{key.to_s.titleize}: #{value}"
|
47
|
+
end
|
48
|
+
msg << ', '
|
49
|
+
end
|
50
|
+
|
51
|
+
msg.chomp(', ')
|
52
|
+
end
|
53
|
+
|
56
54
|
# @param [ OptBase ] opt
|
57
55
|
#
|
58
56
|
# @return [ Array<String> ]
|