sickle 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sickle.rb +12 -5
  3. data/lib/sickle/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3206ca92bf2b085c6ad94ebdc2d15639d8b2f60
4
- data.tar.gz: 0509497cf3267976fda8065c9a4d1a6ec39fd099
3
+ metadata.gz: 37ba6c4218882b2efdb67ab648d29f499eabb624
4
+ data.tar.gz: dcfb6841956fc47a56176d68c87a201209a0ebfd
5
5
  SHA512:
6
- metadata.gz: a7fb3fbbd7b40bffac21c6167639ac126316a1750cb17d207a42ec1326fe0e5d2ce91f801c0e530b6ce44bb91aaec4f695b5d29435755fd8b2ab5010fd4e45a1
7
- data.tar.gz: b84b297c4aac6003c5c4b1d4bd0e65b2274cac71cd3b5c28038e79105e2cecc5d0748cb51c05c94012b0a3b2022eb56eb5ca7dfa525f3600dea202350464eb62
6
+ metadata.gz: af5e069cd2785a641781ebec053010a7a8c795fbb35c62c8ebed3d1dd0f9de7fa36d667e87409d55a958a6dba6ba0ab04aa86ab06e6939ce1436e92c2977c1af
7
+ data.tar.gz: 71cd61ec581dda2986f4fb569021df71de003c7f4f461381675a4515e8469c79295fc5a91746d54b8071480f1396ff06dac2905286ca31c564e36dba306aebac
@@ -250,10 +250,6 @@ module Sickle
250
250
  results[o.name] ||= o.default
251
251
  end
252
252
 
253
- # puts "args: #{args.inspect}"
254
- # puts "results: #{results.inspect}"
255
-
256
-
257
253
  obj = self.new
258
254
  obj.instance_variable_set(:@__options, results)
259
255
 
@@ -261,7 +257,18 @@ module Sickle
261
257
  obj.instance_exec(&@__before_hook)
262
258
  end
263
259
 
264
- command.meth.bind(obj).call(*args)
260
+ req, opt = command.meth.parameters.partition {|(r,_)| r == :req }
261
+ r,o = req.size, opt.size
262
+ argr = (r..(r+o))
263
+
264
+ if argr.include?(args.size)
265
+ command.meth.bind(obj).call(*args)
266
+ else
267
+ puts "\e[31mWrong number of arguments (#{args.size} for #{argr})\e[0m"
268
+ puts
269
+ run(["help", command_name])
270
+ exit 127
271
+ end
265
272
  else
266
273
  puts "\e[31mCommand '#{command_name}' not found\e[0m"
267
274
  puts
@@ -1,3 +1,3 @@
1
1
  module Sickle
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sickle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tymon Tobolski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-24 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler