examples/rakeish in cl-0.1.28 vs examples/rakeish in cl-1.0.0

- old
+ new

@@ -8,45 +8,43 @@ class Create < Cl::Cmd register 'db:create' arg :name - def run; [registry_key, args, opts] end + def run + p cmd: registry_key, args: args, opts: opts + end end class Drop < Cl::Cmd register 'db:drop' arg :name opt '-f', '--force' - def run; [registry_key, args, opts] end + def run + p cmd: registry_key, args: args, opts: opts + end end class Migrate < Cl::Cmd register 'db:migrate' arg :name opt '-v', '--version VERSION' - def run; [registry_key, args, opts] end + def run + p cmd: registry_key, args: args, opts: opts + end end end end -def output(result) - result.each do |cmd, args, opts| - puts "Called #{cmd} with args=#{args} opts=#{opts}" - end - puts -end +Cl.new('rake', runner: :multi).run(%w(db:drop production -f db:create db:migrate production -v 1)) -argv = %w(db:drop production -f db:create db:migrate production -v 1) -output Cl.new($0, runner: :multi).run(argv) - # Output: # -# Called db:drop with args=["production"] opts={:force=>true} -# Called db:create with args=[] opts={} -# Called db:migrate with args=["production"] opts={:version=>"1"} +# {:cmd=>:"db:drop", :args=>["production"], :opts=>{:force=>true}} +# {:cmd=>:"db:create", :args=>[], :opts=>{}} +# {:cmd=>:"db:migrate", :args=>["production"], :opts=>{:version=>"1"}}