moses 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/moses.rb +11 -8
- data/moses.gemspec +2 -3
- metadata +3 -4
- data/HELP.md +0 -10
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/moses.rb
CHANGED
@@ -18,7 +18,7 @@ module Moses
|
|
18
18
|
def default_command(cmd)
|
19
19
|
class_eval %Q{
|
20
20
|
def default_command
|
21
|
-
@default_command ||=
|
21
|
+
@default_command ||= :#{cmd}
|
22
22
|
end
|
23
23
|
}
|
24
24
|
end
|
@@ -34,11 +34,10 @@ module Moses
|
|
34
34
|
|
35
35
|
def self.included(base)
|
36
36
|
base.extend(ClassMethods)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def output
|
40
|
+
@output ||= $stdout
|
42
41
|
end
|
43
42
|
|
44
43
|
def default_commands
|
@@ -70,6 +69,7 @@ module Moses
|
|
70
69
|
def parse_options
|
71
70
|
@args.each_with_index do |arg, index|
|
72
71
|
if flag?(arg)
|
72
|
+
#TODO split compound single dash flags
|
73
73
|
next_index = index + 1
|
74
74
|
if variable_option? index
|
75
75
|
create_variable_option(arg, next_index)
|
@@ -82,7 +82,9 @@ module Moses
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def parse_command
|
85
|
-
|
85
|
+
unless @default_command
|
86
|
+
@command = @args.shift.to_sym if @args.first && @args.first.respond_to?(:to_sym)
|
87
|
+
end
|
86
88
|
end
|
87
89
|
|
88
90
|
def set_option_command
|
@@ -133,6 +135,7 @@ module Moses
|
|
133
135
|
def variable_option?(i)
|
134
136
|
arg = @args[i]
|
135
137
|
next_arg = @args[i+1]
|
138
|
+
#TODO: remove long_flag? check for short flag compatibility
|
136
139
|
long_flag?(arg) && next_arg && not_flag?(next_arg)
|
137
140
|
end
|
138
141
|
|
@@ -155,4 +158,4 @@ module Moses
|
|
155
158
|
content
|
156
159
|
end
|
157
160
|
|
158
|
-
end
|
161
|
+
end
|
data/moses.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "moses"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dayton Nolan"]
|
12
|
-
s.date = "2013-05-
|
12
|
+
s.date = "2013-05-20"
|
13
13
|
s.description = "Moses is a simple command parser for writing command line applications"
|
14
14
|
s.email = "daytonn@gmail.com"
|
15
15
|
s.executables = ["moses"]
|
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
|
|
24
24
|
".ruby-version",
|
25
25
|
"Gemfile",
|
26
26
|
"Gemfile.lock",
|
27
|
-
"HELP.md",
|
28
27
|
"LICENSE",
|
29
28
|
"README.md",
|
30
29
|
"Rakefile",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -122,7 +122,6 @@ files:
|
|
122
122
|
- .ruby-version
|
123
123
|
- Gemfile
|
124
124
|
- Gemfile.lock
|
125
|
-
- HELP.md
|
126
125
|
- LICENSE
|
127
126
|
- README.md
|
128
127
|
- Rakefile
|
@@ -151,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
150
|
version: '0'
|
152
151
|
segments:
|
153
152
|
- 0
|
154
|
-
hash:
|
153
|
+
hash: 3603360791257642318
|
155
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
155
|
none: false
|
157
156
|
requirements:
|
data/HELP.md
DELETED