summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface/action.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/interface/action.rb')
-rw-r--r--lib/puppet/interface/action.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
index 203d80827..622371a4e 100644
--- a/lib/puppet/interface/action.rb
+++ b/lib/puppet/interface/action.rb
@@ -3,6 +3,7 @@ require 'puppet/interface/documentation'
require 'prettyprint'
class Puppet::Interface::Action
+ extend Puppet::Interface::DocGen
include Puppet::Interface::FullDocs
def initialize(face, name, attrs = {})
@@ -44,6 +45,7 @@ class Puppet::Interface::Action
########################################################################
# Documentation...
+ attr_doc :returns
def synopsis
output = PrettyPrint.format do |s|
s.text("puppet #{@face.name}")
@@ -74,8 +76,15 @@ class Puppet::Interface::Action
unless type.is_a? Symbol
raise ArgumentError, "The rendering format must be a symbol, not #{type.class.name}"
end
- return unless @when_rendering.has_key? type
- return @when_rendering[type].bind(@face)
+ # Do we have a rendering hook for this name?
+ return @when_rendering[type].bind(@face) if @when_rendering.has_key? type
+
+ # How about by another name?
+ alt = type.to_s.sub(/^to_/, '').to_sym
+ return @when_rendering[alt].bind(@face) if @when_rendering.has_key? alt
+
+ # Guess not, nothing to run.
+ return nil
end
def set_rendering_method_for(type, proc)
unless proc.is_a? Proc