argparse 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/argsparser.gemspec +1 -0
- data/lib/argsparser/parser.rb +8 -2
- data/lib/argsparser/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f583d4ca7e913ba56b2b25c490d30aaa48b24e8f764534bb544266e5130cb04
|
4
|
+
data.tar.gz: 49bde67b206f8c78cec034f51bc221e7e51dec0b38b1f2127cdfde6bcf10f06d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f780d3fc8fba1448f7fd7a7c5becf02f8f96ff26df228029073111bdb5b32211f43eed7b7a5e781f7c1c0effed5fee0f6c16e813f1d8531b4a7ea6ff7d0951d
|
7
|
+
data.tar.gz: 536b4855fc53650216bbce6f1b3a77a4df4f4b9cc619b63017908101e05f070ea05622d300ae571b614e69f2b0fb6ea55fcbaf25d2a491bb05433e02261eefc0
|
data/argsparser.gemspec
CHANGED
data/lib/argsparser/parser.rb
CHANGED
@@ -6,9 +6,14 @@ module ArgsParser
|
|
6
6
|
@@data = []
|
7
7
|
|
8
8
|
read = :new_arg
|
9
|
+
rmode = nil
|
9
10
|
args.each do |arg|
|
10
11
|
if read == :new_arg
|
11
|
-
if
|
12
|
+
if rmode == :data
|
13
|
+
@@data << arg
|
14
|
+
elsif arg == "--"
|
15
|
+
rmode = :data
|
16
|
+
elsif arg.start_with?("--")
|
12
17
|
b = arg.sub("--", "").split("=")
|
13
18
|
a = b[0].to_sym
|
14
19
|
|
@@ -37,7 +42,7 @@ module ArgsParser
|
|
37
42
|
if rmode == :new_switch
|
38
43
|
if expected_switches.keys.include?(x)
|
39
44
|
if expected_switches[x][:has_argument]
|
40
|
-
if b[1] &&
|
45
|
+
if b[1] && a.length == 1
|
41
46
|
@@switches[x] = {arg: b[1]}
|
42
47
|
else
|
43
48
|
rmode = {arg_for_switch: x}
|
@@ -50,6 +55,7 @@ module ArgsParser
|
|
50
55
|
elsif rmode[:arg_for_switch]
|
51
56
|
@@switches[rmode[:arg_for_switch]][:arg] = arg[c..arg.length-1]
|
52
57
|
rmode = :new_switch
|
58
|
+
break
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
data/lib/argsparser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: argparse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem for parsing command line arguments
|
14
14
|
email: matthias@matthiasclee.com
|
@@ -26,7 +26,8 @@ files:
|
|
26
26
|
- lib/argsparser/version.rb
|
27
27
|
- readme.md
|
28
28
|
homepage: https://github.com/Matthiasclee/ArgParse
|
29
|
-
licenses:
|
29
|
+
licenses:
|
30
|
+
- CC-BY-NC-SA-4.0
|
30
31
|
metadata: {}
|
31
32
|
post_install_message:
|
32
33
|
rdoc_options: []
|
@@ -43,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
44
|
- !ruby/object:Gem::Version
|
44
45
|
version: '0'
|
45
46
|
requirements: []
|
46
|
-
rubygems_version: 3.
|
47
|
+
rubygems_version: 3.1.6
|
47
48
|
signing_key:
|
48
49
|
specification_version: 4
|
49
50
|
summary: A gem for parsing command line arguments
|