slop 4.10.0 → 4.10.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/CHANGELOG.md +7 -0
- data/lib/slop/types.rb +5 -0
- data/lib/slop.rb +1 -1
- data/slop.gemspec +0 -1
- data/test/types_test.rb +7 -0
- metadata +3 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcc0ed29ee91f506402b198ce02623ee1040f8031c327a657377aa80bbf5376e
|
4
|
+
data.tar.gz: fcd35281ea96cca322645275cb51ea3b828a340941d31a862c2f84c711d2c3fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 793194abed9bad4d6c1c764685453078130caee0ad65065b94aac4759320391f4b45bc367311391afd2af55dcabc1b513ad82003a42dc85b6b8621559815e03d
|
7
|
+
data.tar.gz: 4954ca723cc9f0550938ba5e95cd7bf50f0586501da1ae957f035181fcbbbfdbdf2a053f0c7849c236a84bc156abc1d96b5046eee55b79d65f4b46d4517f626a
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
v4.10.1 (2023-02-26)
|
5
|
+
--------------------
|
6
|
+
|
7
|
+
Bug fixes
|
8
|
+
* Fix boolean flags from being invalid when followed by arguments #279
|
9
|
+
|
4
10
|
v4.10.0 (2023-02-15)
|
11
|
+
--------------------
|
5
12
|
|
6
13
|
Features:
|
7
14
|
* Add support for optional type validation [#278](https://github.com/leejarvis/slop/pull/278) (Victor Gama)
|
data/lib/slop/types.rb
CHANGED
@@ -26,6 +26,11 @@ module Slop
|
|
26
26
|
VALID_VALUES = (FALSE_VALUES + TRUE_VALUES).freeze
|
27
27
|
|
28
28
|
def valid?(value)
|
29
|
+
# If we don't want to validate the type, then we don't care if the value
|
30
|
+
# is valid or not. Otherwise we would prevent boolean flags followed by
|
31
|
+
# arguments from being parsed correctly.
|
32
|
+
return true unless config[:validate_type]
|
33
|
+
|
29
34
|
return true if value.is_a?(String) && value.start_with?("--")
|
30
35
|
value.nil? || VALID_VALUES.include?(value)
|
31
36
|
end
|
data/lib/slop.rb
CHANGED
data/slop.gemspec
CHANGED
@@ -10,7 +10,6 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = 'ljjarvis@gmail.com'
|
11
11
|
s.homepage = 'http://github.com/leejarvis/slop'
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
|
-
s.test_files = `git ls-files -- test/*`.split("\n")
|
14
13
|
s.license = 'MIT'
|
15
14
|
|
16
15
|
s.required_ruby_version = '>= 2.0.0'
|
data/test/types_test.rb
CHANGED
@@ -66,6 +66,13 @@ describe Slop::BoolOption do
|
|
66
66
|
@result.parser.parse %w(--verbose foo)
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
# Like above but without validate_type
|
71
|
+
it "returns true if used and ignores the value" do
|
72
|
+
@result.parser.parse %w(--quiet foo)
|
73
|
+
|
74
|
+
assert_equal true, @result[:quiet]
|
75
|
+
end
|
69
76
|
end
|
70
77
|
|
71
78
|
describe Slop::IntegerOption do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.10.
|
4
|
+
version: 4.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Jarvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -90,12 +90,4 @@ rubygems_version: 3.3.7
|
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: Simple Lightweight Option Parsing
|
93
|
-
test_files:
|
94
|
-
- test/error_test.rb
|
95
|
-
- test/option_test.rb
|
96
|
-
- test/options_test.rb
|
97
|
-
- test/parser_test.rb
|
98
|
-
- test/result_test.rb
|
99
|
-
- test/slop_test.rb
|
100
|
-
- test/test_helper.rb
|
101
|
-
- test/types_test.rb
|
93
|
+
test_files: []
|