args_parser 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/args_parser.rb +1 -1
- data/lib/args_parser/parser.rb +2 -2
- data/test/test_args_parser_style_equal.rb +3 -3
- metadata +112 -99
data/History.txt
CHANGED
data/lib/args_parser.rb
CHANGED
data/lib/args_parser/parser.rb
CHANGED
@@ -37,10 +37,10 @@ module ArgsParser
|
|
37
37
|
@validator = Validator.new
|
38
38
|
|
39
39
|
filter do |v|
|
40
|
-
(v.kind_of? String and v =~
|
40
|
+
(v.kind_of? String and v =~ /^-?\d+$/) ? v.to_i : v
|
41
41
|
end
|
42
42
|
filter do |v|
|
43
|
-
(v.kind_of? String and v =~
|
43
|
+
(v.kind_of? String and v =~ /^-?\d+\.\d+$/) ? v.to_f : v
|
44
44
|
end
|
45
45
|
on_filter_error do |err, name, value|
|
46
46
|
raise err
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
2
2
|
|
3
3
|
class TestArgsParserStyleEqual < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
@argv = 'test --input=http://shokai.org --a --o=./out -h --depth
|
5
|
+
@argv = 'test --input=http://shokai.org --a --o=./out -h --depth=-030 foo bar --pi=-3.140 --n=ShoKaI'.split(/\s+/)
|
6
6
|
@parser = ArgsParser.parse @argv, :style => :equal do
|
7
7
|
arg :input, 'input', :alias => :i
|
8
8
|
arg :output, 'output dir', :alias => :o
|
@@ -36,12 +36,12 @@ class TestArgsParserStyleEqual < Test::Unit::TestCase
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_cast_integer
|
39
|
-
assert @parser[:depth] == 30
|
39
|
+
assert @parser[:depth] == -30
|
40
40
|
assert @parser[:depth].class == Fixnum
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_cast_float
|
44
|
-
assert @parser[:pi] == 3.14
|
44
|
+
assert @parser[:pi] == -3.14
|
45
45
|
assert @parser[:pi].class == Float
|
46
46
|
end
|
47
47
|
|
metadata
CHANGED
@@ -1,118 +1,131 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: args_parser
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.10
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.9
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- Sho Hashimoto
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
12
|
+
date: 2012-09-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rdoc
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.10'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.10'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: newgem
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.5.3
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.5.3
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: hoe
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.1'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
48
62
|
description: Parse ARGV from command line with DSL.
|
49
|
-
email:
|
50
|
-
|
63
|
+
email:
|
64
|
+
- hashimoto@shokai.org
|
51
65
|
executables: []
|
52
|
-
|
53
66
|
extensions: []
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
- .gemtest
|
67
|
+
extra_rdoc_files:
|
68
|
+
- History.txt
|
69
|
+
- Manifest.txt
|
70
|
+
- README.rdoc
|
71
|
+
files:
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
|
+
- History.txt
|
75
|
+
- Manifest.txt
|
76
|
+
- README.rdoc
|
77
|
+
- Rakefile
|
78
|
+
- lib/args_parser.rb
|
79
|
+
- lib/args_parser/config.rb
|
80
|
+
- lib/args_parser/error.rb
|
81
|
+
- lib/args_parser/filter.rb
|
82
|
+
- lib/args_parser/parser.rb
|
83
|
+
- lib/args_parser/styles/default.rb
|
84
|
+
- lib/args_parser/styles/equal.rb
|
85
|
+
- lib/args_parser/validator.rb
|
86
|
+
- samples/download_webpage.rb
|
87
|
+
- samples/twitter_timeline.rb
|
88
|
+
- script/console
|
89
|
+
- script/destroy
|
90
|
+
- script/generate
|
91
|
+
- test/test_args_parser.rb
|
92
|
+
- test/test_args_parser_style_equal.rb
|
93
|
+
- test/test_filter.rb
|
94
|
+
- test/test_helper.rb
|
95
|
+
- test/test_validator.rb
|
96
|
+
- .gemtest
|
85
97
|
homepage: http://shokai.github.com/args_parser
|
86
98
|
licenses: []
|
87
|
-
|
88
99
|
post_install_message:
|
89
|
-
rdoc_options:
|
90
|
-
|
91
|
-
|
92
|
-
require_paths:
|
93
|
-
|
94
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
rdoc_options:
|
101
|
+
- --main
|
102
|
+
- README.rdoc
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
106
|
none: false
|
96
|
-
requirements:
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
hash: 3130304465783938517
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
115
|
none: false
|
102
|
-
requirements:
|
103
|
-
|
104
|
-
|
105
|
-
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
106
120
|
requirements: []
|
107
|
-
|
108
121
|
rubyforge_project: args_parser
|
109
|
-
rubygems_version: 1.8.
|
122
|
+
rubygems_version: 1.8.24
|
110
123
|
signing_key:
|
111
124
|
specification_version: 3
|
112
125
|
summary: Parse ARGV from command line with DSL.
|
113
|
-
test_files:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
126
|
+
test_files:
|
127
|
+
- test/test_args_parser.rb
|
128
|
+
- test/test_args_parser_style_equal.rb
|
129
|
+
- test/test_filter.rb
|
130
|
+
- test/test_helper.rb
|
131
|
+
- test/test_validator.rb
|