argparse 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/argsparser/options.rb +1 -1
- data/lib/argsparser/parser.rb +3 -1
- data/lib/argsparser/switches.rb +1 -1
- data/lib/argsparser/version.rb +1 -1
- metadata +6 -7
- data/test.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e799b6161254080e3721a25b8ee155a8b6fc886ba72dac606e4d35cee72d7e9f
|
4
|
+
data.tar.gz: 36c12eef6f29b6da6506ccba16a4fef4ec98e02e7175a10a05026cf5e449d8fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a7daa4fbed759fb886ee575ce39bb41a3d9b80f528f7e7b555b7f33ead01148244d0c6d651a671d3cdd7a6c92f8a1d5be2ab731c85e89f075cc08322a3b95d7
|
7
|
+
data.tar.gz: 921aee45677843f4b84f5bd8735efac1ad1b6eae892e77c59991e2bab820847ab8c02179701cfa55c6d21b81a79fd886b83169f838acdf0500090f397fddc7c0
|
data/lib/argsparser/options.rb
CHANGED
data/lib/argsparser/parser.rb
CHANGED
@@ -29,8 +29,10 @@ module ArgsParser
|
|
29
29
|
a = b[0].split("")
|
30
30
|
|
31
31
|
rmode = :new_switch
|
32
|
+
c = 0
|
32
33
|
a.each do |x|
|
33
34
|
x = x.to_sym
|
35
|
+
c = c + 1
|
34
36
|
|
35
37
|
if rmode == :new_switch
|
36
38
|
if expected_switches.keys.include?(x)
|
@@ -46,7 +48,7 @@ module ArgsParser
|
|
46
48
|
end
|
47
49
|
end
|
48
50
|
elsif rmode[:arg_for_switch]
|
49
|
-
@@switches[rmode[:arg_for_switch]][:arg] =
|
51
|
+
@@switches[rmode[:arg_for_switch]][:arg] = arg[c..arg.length-1]
|
50
52
|
rmode = :new_switch
|
51
53
|
end
|
52
54
|
end
|
data/lib/argsparser/switches.rb
CHANGED
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Lee
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem for parsing command line arguments
|
14
14
|
email: matthias@matthiasclee.com
|
@@ -25,11 +25,10 @@ files:
|
|
25
25
|
- lib/argsparser/switches.rb
|
26
26
|
- lib/argsparser/version.rb
|
27
27
|
- readme.md
|
28
|
-
- test.rb
|
29
28
|
homepage: https://github.com/Matthiasclee/ArgParse
|
30
29
|
licenses: []
|
31
30
|
metadata: {}
|
32
|
-
post_install_message:
|
31
|
+
post_install_message:
|
33
32
|
rdoc_options: []
|
34
33
|
require_paths:
|
35
34
|
- lib
|
@@ -44,8 +43,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
46
45
|
requirements: []
|
47
|
-
rubygems_version: 3.
|
48
|
-
signing_key:
|
46
|
+
rubygems_version: 3.2.3
|
47
|
+
signing_key:
|
49
48
|
specification_version: 4
|
50
49
|
summary: A gem for parsing command line arguments
|
51
50
|
test_files: []
|
data/test.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "argparse"
|
2
|
-
|
3
|
-
o = {
|
4
|
-
asd: { has_argument: false },
|
5
|
-
qwe: { has_argument: true }
|
6
|
-
}
|
7
|
-
|
8
|
-
s = {
|
9
|
-
q: { has_argument: true },
|
10
|
-
a: { }
|
11
|
-
}
|
12
|
-
|
13
|
-
x=ArgsParser::Args.new(options: o, switches: s)
|
14
|
-
|
15
|
-
puts x.switches[:q]
|
16
|
-
puts x.switches[:a]
|
17
|
-
puts x.options[:asd]
|
18
|
-
puts x.options[:qwe]
|
19
|
-
|
20
|
-
puts x.data.to_s
|