lib/applix.rb in applix-0.4.10 vs lib/applix.rb in applix-0.4.11

- old
+ new

@@ -11,12 +11,14 @@ self.main!(argv, app_defaults, &blk) rescue => e puts <<-TXT -usage: #{$0} <args...>" + ## #{e} +usage: #{$0} <args...> + TXT end # raises exception on error # dumps callstack in case of error when --debug is enabled @@ -101,10 +103,25 @@ def epilog &blk @epilog_cb = blk end - def any &blk + def any(opts = {}, &blk) + if(app = opts[:argsloop]) + blk = lambda do |*args, opts| + while(args && 0 < args.size) do + args = begin + if(op = args.shift) + puts " --(#{op})-- (#{args.join ', '})" + app.send(op, args, opts) + end + rescue ArgumentError => e + app.send(op, opts) + end + end + end + end + tasks[:any] = { :name => :any, :code => blk } end def cluster name, &blk tasks[name.to_sym] = { :name => name, :code => blk, :cluster => true }