lib/commands/support.rb in testlab-1.18.1 vs lib/commands/support.rb in testlab-1.19.0

- old
+ new

@@ -44,20 +44,29 @@ command component do |c| c.desc %(Optional #{component} ID or comma separated list of #{component} IDs) c.arg_name %(#{component}[,#{component},...]) c.flag [:n, :name] + c.desc %(Force the actions verbatium, do not attempt to infer shortcuts; this has no effect for most operations) + c.switch [:f, :force] + LAB_ACTION_ORDER.each do |lab_action| action_desc = LAB_ACTIONS[lab_action] c.desc(action_desc.first % "#{component}s") c.long_desc(ZTK::Template.string(action_desc.last, {:component => "#{component}s"})) c.command lab_action do |la| + la.action do |global_options, options, args| iterate_objects_by_name(options[:name], klass) do |object| - object.send(lab_action) + if %w( build recycle ).map(&:to_sym).include?(lab_action) + object.send(lab_action, options[:force]) + else + object.send(lab_action) + end end end + end end !block.nil? and block.call(c) end