clint 0.1.1 → 0.1.2
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.
- data/lib/clint.rb +13 -11
- data/man/clint.7.gz +0 -0
- metadata +7 -3
data/lib/clint.rb
CHANGED
@@ -139,24 +139,26 @@ class Clint
|
|
139
139
|
# Execute the subcommand as a class method.
|
140
140
|
if klass.singleton_methods(false).include? subcommand.to_s
|
141
141
|
arity = klass.method(subcommand).arity
|
142
|
-
if @args.length
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
klass.send subcommand, *@args
|
142
|
+
if @args.length == arity || -@args.length - 1 == arity
|
143
|
+
begin
|
144
|
+
klass.send subcommand, *(@args + [@options])
|
145
|
+
rescue ArgumentError
|
146
|
+
klass.send subcommand, *@args
|
147
|
+
end
|
148
|
+
exit 0
|
150
149
|
end
|
151
|
-
exit 0
|
152
150
|
end
|
153
151
|
|
154
152
|
# Execute the subcommand as an instance method.
|
155
|
-
|
153
|
+
arity = klass.allocate.method(:initialize).arity
|
154
|
+
if 0 > arity
|
155
|
+
arity = arity.abs - 1
|
156
|
+
end
|
157
|
+
if arity > @args.length
|
156
158
|
usage
|
157
159
|
exit 1
|
158
160
|
end
|
159
|
-
instance = klass.new(@args.
|
161
|
+
instance = klass.new(@args.slice!(0, arity))
|
160
162
|
if instance.public_methods(false).include? subcommand.to_s
|
161
163
|
arity = instance.method(subcommand).arity
|
162
164
|
if @args.length != arity && -@args.length - 1 != arity
|
data/man/clint.7.gz
CHANGED
Binary file
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Richard Crowley
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-03-03 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -54,6 +54,10 @@ description: |
|
|
54
54
|
|
55
55
|
Due to limitations in the Ruby 1.8 grammar, all methods that could act as subcommands must not declare default argument values except `options={}` if desired.
|
56
56
|
|
57
|
+
## THEME SONG
|
58
|
+
|
59
|
+
Leo Arnaud and John Williams - "Bugler's Dream"
|
60
|
+
|
57
61
|
## AUTHOR
|
58
62
|
|
59
63
|
Richard Crowley <r@rcrowley.org>
|