opt_parse_validator 0.0.14.0 → 0.0.14.1
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 +4 -4
- data/README.md +1 -1
- data/lib/opt_parse_validator/opts/base.rb +4 -4
- data/lib/opt_parse_validator/version.rb +1 -1
- data/lib/opt_parse_validator.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0286c5b4aeeef23b862af3aa5f029908b5965bd1'
|
4
|
+
data.tar.gz: 625e42c2b8e97c9f448aec2612a6893ad0c02539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7d1bd2b8315771f040b1467cd27d475151d860c898ee90b8872f16efca592de1d73f14cbe502e4556e6cc5d9438250335800cca71e8b67fa9f5ae95676cbeea
|
7
|
+
data.tar.gz: 59e2147c23f7ce56a749c3c124a49b7b8508d86be105a7ab7a537830c71afe8dc98da23836cec2819770e17d87b2da9ddc100dec889db2fb6fb1bbfaac4b4452
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ Please Feel free to send Pull Requests to improve this Readme
|
|
52
52
|
Some attributes are available for all Validators:
|
53
53
|
- :required (whether or not the associated cli option is required/mandatory - [example](https://github.com/wpscanteam/CMSScanner/blob/master/app/controllers/core/cli_options.rb#L9)).
|
54
54
|
- :required_unless (like the above, except if the option/s given in this parameter are called in the CLI - [example](https://github.com/wpscanteam/wpscan-v3/blob/master/app/controllers/core.rb#L7), can be a single symbol or array of symbols)
|
55
|
-
- :default (Default value to use if the option is not supplied,
|
55
|
+
- :default (Default value to use if the option is not supplied, the correct format has to be used as it won't go through the validation and normalization processes)
|
56
56
|
- :value_if_empty (Value to use if no argument has been supplied for the related option)
|
57
57
|
|
58
58
|
### Available Validators & Associated Attributes:
|
@@ -7,11 +7,11 @@ module OptParseValidator
|
|
7
7
|
|
8
8
|
# @param [ Array ] option See OptionParser#on
|
9
9
|
# @param [ Hash ] attrs
|
10
|
-
# @option attrs
|
10
|
+
# @option attrs [ Boolean ] :required
|
11
11
|
# @options attrs [ Array<Symbol>, Symbol ] :required_unless
|
12
|
-
# @option attrs
|
13
|
-
# @option attrs
|
14
|
-
# @option attrs
|
12
|
+
# @option attrs [ Mixed ] :default The default value to use if the option is not supplied
|
13
|
+
# @option attrs [ Mixed ] :value_if_empty The value to use if no argument has been supplied
|
14
|
+
# @option attrs [ Array<Symbol> ] :normalize See #normalize
|
15
15
|
#
|
16
16
|
# @note The :default and :normalize 'logics' are done in OptParseValidator::OptParser#add_option
|
17
17
|
def initialize(option, attrs = {})
|
data/lib/opt_parse_validator.rb
CHANGED
@@ -41,7 +41,9 @@ module OptParseValidator
|
|
41
41
|
@opts << opt
|
42
42
|
@symbols_used << opt.to_sym
|
43
43
|
# Set the default option value if it exists
|
44
|
-
|
44
|
+
# The default value is not validated as provided by devs
|
45
|
+
# and should be set to the correct format/value directly
|
46
|
+
@results[opt.to_sym] = opt.default unless opt.default.nil?
|
45
47
|
|
46
48
|
on(*opt.option) do |arg|
|
47
49
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opt_parse_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.14.
|
4
|
+
version: 0.0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WPScanTeam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|