From 3ffb9abd3a500f1fb3246e04f737b79d232c082d Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 8 Feb 2011 21:27:24 -0800 Subject: Moving 'format' support to the application This allows easier use of the Interfaces in ruby. Signed-off-by: Luke Kanies --- lib/puppet/application/data_baseclass.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/data_baseclass.rb b/lib/puppet/application/data_baseclass.rb index 3f498f56f..e67b1b368 100644 --- a/lib/puppet/application/data_baseclass.rb +++ b/lib/puppet/application/data_baseclass.rb @@ -18,7 +18,7 @@ class Puppet::Application::DataBaseclass < Puppet::Application end option("--format FORMAT") do |arg| - @format = arg + @format = arg.to_sym end # XXX this doesn't work, I think @@ -46,11 +46,11 @@ class Puppet::Application::DataBaseclass < Puppet::Application def main # Call the method associated with the provided action (e.g., 'find'). - interface.send(verb, name, *arguments) + result = interface.send(verb, name, *arguments) + puts result.render(format) end def setup - @format ||= :yaml Puppet::Util::Log.newdestination :console @@ -60,7 +60,7 @@ class Puppet::Application::DataBaseclass < Puppet::Application @type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym @interface = Puppet::Interface.interface(@type).new - @interface.format = format if format + @format ||= @interface.class.default_format || :pson validate -- cgit