opt_parse_validator 0.0.13.7 → 0.0.13.8

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: 5b0b19c4ac86b581d9ef569f2de3179b28580055
4
- data.tar.gz: 333ffe9bef4c43a2446a6af4eb49e2a8ea82e24c
3
+ metadata.gz: f8b96bf2df00c21b5dd5be7b553495196f7f7190
4
+ data.tar.gz: 7091246c62fe01bb6a1437ba265ef5d755409d46
5
5
  SHA512:
6
- metadata.gz: 56a49fcad03a6a9e42cb299488aab56a26fda9c73d96df6e10d76be98e09dcfd73b5f32f15fa5bb326d5132d5fecb9f9b5687da718ee6cb31b837c84a5b6c3b8
7
- data.tar.gz: cf48d2ee2a29e1913930513fd886b1ffcee8677dd60f125dc0d2e108de8d2aa05300f888f9875a74d816bfd74b5dd58c7b58cd5912329eb173deb97d890d244e
6
+ metadata.gz: '0338d5ddadd4aeef34af392f5aa3d51ada1deb93cffe3f04cb7fb86073c6c8613e8b9b70f78b833a2106e2ff9ac35605b9b65b792cb3f66eb2ecf859c7fcea5f'
7
+ data.tar.gz: b0641b222b4f7ff8136e5bfaa4d6fb2d2e61543ed1fd915e526470b4ae03282b38ac9ee143bce8f077f0f9180053bbd17fbc021028cc3b7e22f8a6c09a05d317
data/README.md CHANGED
@@ -8,7 +8,46 @@ OptParseValidator
8
8
  [![Dependency Status](https://img.shields.io/gemnasium/wpscanteam/OptParseValidator.svg)](https://gemnasium.com/wpscanteam/OptParseValidator)
9
9
 
10
10
 
11
- ### Available Validators & associated attributes:
11
+ ### Installation
12
+
13
+ ```gem install opt_parse_validator```
14
+
15
+ ### Usage Example
16
+
17
+ ```ruby
18
+ # test.rb
19
+
20
+ require 'opt_parse_validator'
21
+
22
+ # For contructor options, such as setting a banner, the summary width and indent,
23
+ # see http://ruby-doc.org/stdlib-2.4.2/libdoc/optparse/rdoc/OptionParser.html#method-c-new
24
+ parser = OptParseValidator::OptParser.new
25
+
26
+ parser.add(
27
+ OptParseValidator::OptString.new(['-m', '--mandatory PARAM', 'A Mandatory CLI option'], required: true),
28
+ OptParseValidator::OptBoolean.new(['--test', '-t', 'Option Helper Message']),
29
+ OptParseValidator::OptFilePath.new(['-o', '--output FILE', 'Output to FILE'], writable: true, exists: false)
30
+ )
31
+
32
+ begin
33
+ p parser.results
34
+ rescue OptParseValidator::Error => e
35
+ puts 'Parsing Error: ' + e.message
36
+ end
37
+ ```
38
+
39
+ Then have a play with
40
+ ```ruby test.rb -h```
41
+ ```ruby test.rb -m hh -t```
42
+ ```ruby test.rb -t```
43
+
44
+ For more option examples, see
45
+ - https://github.com/wpscanteam/CMSScanner/blob/master/app/controllers/core/cli_options.rb
46
+ - https://github.com/wpscanteam/wpscan-v3/blob/master/app/controllers/enumeration/cli_options.rb
47
+
48
+ Please Feel free to send Pull Requests to improve this Readme
49
+
50
+ ### Available Validators & Associated Attributes:
12
51
  - Array
13
52
  - :separator (default: ',')
14
53
  - Boolean
@@ -46,7 +46,7 @@ module OptParseValidator
46
46
  on(*opt.option) do |arg|
47
47
  begin
48
48
  @results[opt.to_sym] = opt.normalize(opt.validate(arg))
49
- rescue => e
49
+ rescue StandardError => e
50
50
  # Adds the long option name to the message
51
51
  # And raises it as an OptParseValidator::Error if not already one
52
52
  # e.g --proxy Invalid Scheme format.
@@ -72,7 +72,7 @@ module OptParseValidator
72
72
  post_processing
73
73
 
74
74
  @results
75
- rescue => e
75
+ rescue StandardError => e
76
76
  # Raise it as an OptParseValidator::Error if not already one
77
77
  raise e.is_a?(Error) ? e.class : Error, e.message
78
78
  end
@@ -4,6 +4,7 @@ module OptParseValidator
4
4
  # @return [ Void ]
5
5
  def append_help_messages
6
6
  option << "Separator to use between the headers: '; '"
7
+ option << "Examples: 'X-Forwarded-For: 127.0.0.1', 'X-Forwarded-For: 127.0.0.1; Another: aaa'"
7
8
  end
8
9
 
9
10
  # @param [ String ] value
@@ -1,4 +1,4 @@
1
1
  # Gem Version
2
2
  module OptParseValidator
3
- VERSION = '0.0.13.7'.freeze
3
+ VERSION = '0.0.13.8'.freeze
4
4
  end
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.13.7
4
+ version: 0.0.13.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - WPScanTeam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-16 00:00:00.000000000 Z
11
+ date: 2017-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable