lib/clamp/subcommand/execution.rb in clamp-0.1.6 vs lib/clamp/subcommand/execution.rb in clamp-0.1.7

- old
+ new

@@ -7,10 +7,15 @@ def execute_subcommand signal_usage_error "no subcommand specified" unless subcommand_name subcommand_class = find_subcommand_class(subcommand_name) subcommand = subcommand_class.new("#{invocation_path} #{subcommand_name}", context) - subcommand.parent_command = self + self.class.declared_options.each do |option| + option_set = instance_variable_defined?(option.ivar_name) + if option_set && subcommand.respond_to?(option.write_method) + subcommand.send(option.write_method, self.send(option.read_method)) + end + end subcommand.run(subcommand_arguments) end private