getopt 1.7.0 → 1.7.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
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +4 -1
- data/getopt.gemspec +1 -1
- data/lib/getopt/long.rb +3 -3
- data/lib/getopt/std.rb +1 -1
- data/lib/getopt/version.rb +1 -1
- data/spec/getopt_long_spec.rb +14 -1
- data/spec/getopt_std_spec.rb +6 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1df233b5fdf5032c1f424f1c3966755f7e16eaf2dc7f14355105bb0afe57d84
|
|
4
|
+
data.tar.gz: 1015a29bc20669f3ae22d4f03cc7d75790b5a31d872f874821ca1d9be1100c3c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44fa9976543e80797a085028c5fcb27045c9a7cc093add9b777a6f4705189b29eb2458eb9d46a0a6ae20a958fa39e0f4da17d2362989bae38146b647e451005f
|
|
7
|
+
data.tar.gz: 21947ee37c4e309a6c132db383126577145c6cdb8d86e162c1b7acd37f0ef2be90c8422d5d8a3dbf9dfbf5d9e2f51f2e7eed0055dd37a1940c2193f337878759
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGES.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
# 1.7.
|
|
1
|
+
# 1.7.1 - 20-May-2026
|
|
2
|
+
* Fixed short option parsing so aliases like `-?` work again. Thanks go to swabianeagle for the spot.
|
|
3
|
+
|
|
4
|
+
## 1.7.0 - 13-Feb-2026
|
|
2
5
|
* Added the NEGATABLE option so you can do --no-whatever.
|
|
3
6
|
* A few warnings were cleaned up, along with rubocop updates.
|
|
4
7
|
* Some administrative stuff, updated Rakefile, Gemfile, etc.
|
data/getopt.gemspec
CHANGED
data/lib/getopt/long.rb
CHANGED
|
@@ -94,9 +94,9 @@ module Getopt
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
re_long = /^(--\w+[-\w+]*)?$/
|
|
97
|
-
re_short = /^(
|
|
98
|
-
re_long_eq = /^(--\w+[-\w+]*)?=(.*?)$|(
|
|
99
|
-
re_short_sq = /^(
|
|
97
|
+
re_short = /^(-[^\s-])$/
|
|
98
|
+
re_long_eq = /^(--\w+[-\w+]*)?=(.*?)$|(-[^\s-])=(.*?)$/
|
|
99
|
+
re_short_sq = /^(-[^\s-])(\S+?)$/
|
|
100
100
|
|
|
101
101
|
ARGV.each_with_index do |opt, index|
|
|
102
102
|
# Allow either -x -v or -xv style for single char args
|
data/lib/getopt/std.rb
CHANGED
|
@@ -46,7 +46,7 @@ module Getopt
|
|
|
46
46
|
def self.getopts(switches)
|
|
47
47
|
args = switches.split(/ */)
|
|
48
48
|
hash = {}
|
|
49
|
-
regex = /^-(
|
|
49
|
+
regex = /^-([^\s-])\s*(\S*)/s
|
|
50
50
|
|
|
51
51
|
while !ARGV.empty? && regex.match(ARGV.first)
|
|
52
52
|
first, rest = Regexp.last_match(1), Regexp.last_match(2)
|
data/lib/getopt/version.rb
CHANGED
data/spec/getopt_long_spec.rb
CHANGED
|
@@ -20,7 +20,7 @@ RSpec.describe Getopt::Long do
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
example 'version' do
|
|
23
|
-
expect(Getopt::Long::VERSION).to eq('1.7.
|
|
23
|
+
expect(Getopt::Long::VERSION).to eq('1.7.1')
|
|
24
24
|
expect(Getopt::Long::VERSION).to be_frozen
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -112,6 +112,19 @@ RSpec.describe Getopt::Long do
|
|
|
112
112
|
expect(@opts['b']).to eq('world')
|
|
113
113
|
end
|
|
114
114
|
|
|
115
|
+
example 'getopts long accepts question mark as a short switch' do
|
|
116
|
+
ARGV.push('-?')
|
|
117
|
+
|
|
118
|
+
expect{
|
|
119
|
+
@opts = described_class.getopts(
|
|
120
|
+
['--help', '-?', Getopt::BOOLEAN]
|
|
121
|
+
)
|
|
122
|
+
}.not_to raise_error
|
|
123
|
+
|
|
124
|
+
expect(@opts['help']).to be(true)
|
|
125
|
+
expect(@opts['?']).to be(true)
|
|
126
|
+
end
|
|
127
|
+
|
|
115
128
|
example 'getopts long increment type works as expected' do
|
|
116
129
|
ARGV.push('-m', '-m')
|
|
117
130
|
|
data/spec/getopt_std_spec.rb
CHANGED
|
@@ -15,7 +15,7 @@ RSpec.describe Getopt::Std do
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
example 'version' do
|
|
18
|
-
expect(described_class::VERSION).to eq('1.7.
|
|
18
|
+
expect(described_class::VERSION).to eq('1.7.1')
|
|
19
19
|
expect(described_class::VERSION).to be_frozen
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -59,6 +59,11 @@ RSpec.describe Getopt::Std do
|
|
|
59
59
|
expect(described_class.getopts('ID')).to eq({'I' => true, 'D' => true})
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
example 'getopts accepts question mark as a switch' do
|
|
63
|
+
ARGV.push('-?')
|
|
64
|
+
expect(described_class.getopts('?')).to eq({'?' => true})
|
|
65
|
+
end
|
|
66
|
+
|
|
62
67
|
example 'getopts with separated switches and mandatory argument' do
|
|
63
68
|
ARGV.push('-o', 'hello', '-I', '-D')
|
|
64
69
|
expect(described_class.getopts('o:ID')).to eq({'o' => 'hello', 'I' => true, 'D' => true})
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: getopt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
148
|
version: '0'
|
|
149
149
|
requirements: []
|
|
150
|
-
rubygems_version: 4.0.
|
|
150
|
+
rubygems_version: 4.0.6
|
|
151
151
|
specification_version: 4
|
|
152
152
|
summary: Getopt::Std and Getopt::Long option parsers for Ruby
|
|
153
153
|
test_files:
|
metadata.gz.sig
CHANGED
|
Binary file
|