From 1b4d7a51d10b217c7f67f3876242fff6dc694faa Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Mon, 4 Apr 2011 16:46:09 -0700 Subject: (#6962) Create the basic shape of the help face. This implements the basic help face, along with the start of the support structures; we include the basic application, and the default help action that just emits a listing of faces and other discovered stuff... Reviewed-By: Matt Robinson --- lib/puppet/application/help.rb | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/puppet/application/help.rb (limited to 'lib/puppet/application/help.rb') diff --git a/lib/puppet/application/help.rb b/lib/puppet/application/help.rb new file mode 100644 index 000000000..69905af27 --- /dev/null +++ b/lib/puppet/application/help.rb @@ -0,0 +1,7 @@ +require 'puppet/application/faces_base' + +class Puppet::Application::Help < Puppet::Application::FacesBase + def render(result) + puts result.join("\n") + end +end -- cgit From 26db6456d22b95486646ae5b8b001acb2051c4da Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Mon, 11 Apr 2011 11:26:25 -0700 Subject: (#6962) render prints the rval; fix help subcommand. The face application base uses render to transform the returned object to a form where #to_s produces the output intended for the end user; we were actually printing in the method instead, leading to an extraneous 'nil' at the end of the output... Paired-With: Matt Robinson --- lib/puppet/application/help.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/application/help.rb') diff --git a/lib/puppet/application/help.rb b/lib/puppet/application/help.rb index 69905af27..b3666f12d 100644 --- a/lib/puppet/application/help.rb +++ b/lib/puppet/application/help.rb @@ -2,6 +2,6 @@ require 'puppet/application/faces_base' class Puppet::Application::Help < Puppet::Application::FacesBase def render(result) - puts result.join("\n") + result.join("\n") end end -- cgit From 2a87f410eae84a0a7c4f39d9c1ef742c3e7ba8fc Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Mon, 11 Apr 2011 16:43:56 -0700 Subject: (#6962) Override 'render' in help to just return the string. The default behaviour is to serialize the result somehow, defaulting to displayed, render should be a no-op. This means overriding the parent method. Paired-With: Matt Robinson --- lib/puppet/application/help.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/puppet/application/help.rb') diff --git a/lib/puppet/application/help.rb b/lib/puppet/application/help.rb index b3666f12d..fd8818db0 100644 --- a/lib/puppet/application/help.rb +++ b/lib/puppet/application/help.rb @@ -1,7 +1,8 @@ +# -*- coding: utf-8 -*- require 'puppet/application/faces_base' class Puppet::Application::Help < Puppet::Application::FacesBase - def render(result) - result.join("\n") - end + # Meh. Disable the default behaviour, which is to inspect the + # string and return that – not so helpful. --daniel 2011-04-11 + def render(result) result end end -- cgit