summaryrefslogtreecommitdiffstats
path: root/lib/puppet/face
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-26 17:18:09 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-26 23:35:31 -0700
commit092ab09d00474d69361ee757efde2b28c89b39eb (patch)
tree4972d871be768411316e357198ee910e536f7324 /lib/puppet/face
parent67a86554fff18cd75744ea987ea2361f495efc4c (diff)
downloadpuppet-092ab09d00474d69361ee757efde2b28c89b39eb.tar.gz
puppet-092ab09d00474d69361ee757efde2b28c89b39eb.tar.xz
puppet-092ab09d00474d69361ee757efde2b28c89b39eb.zip
(#6962) Extend documentation API for Faces.
This adds the remaining documentation mechanisms to the Face instances, allowing them to build and report correct documentation, licensing and ownership for the help face to build on.
Diffstat (limited to 'lib/puppet/face')
-rw-r--r--lib/puppet/face/help/action.erb48
-rw-r--r--lib/puppet/face/help/face.erb46
2 files changed, 89 insertions, 5 deletions
diff --git a/lib/puppet/face/help/action.erb b/lib/puppet/face/help/action.erb
index eaf131464..7a9b87117 100644
--- a/lib/puppet/face/help/action.erb
+++ b/lib/puppet/face/help/action.erb
@@ -1,3 +1,47 @@
-Use: puppet <%= face.name %> [options] <%= action.name %> [options]
+puppet <%= face.name %><%= action.default? ? '' : " #{action.name}" %>(1) -- <%= action.summary || face.summary %>
+<%= '=' * (_erbout.length - 1) %>
-Summary: <%= action.summary %>
+% if action.synopsis
+SYNOPSIS
+--------
+
+<%= action.synopsis %>
+
+% end
+% if action.description
+DESCRIPTION
+-----------
+<%= action.description %>
+
+%end
+% unless action.options.empty?
+OPTIONS
+-------
+% action.options.sort.each do |name|
+% option = action.get_option name
+<%= " " + option.optparse.join(" |" ) %>
+<%= option.desc and option.desc.gsub(/^/, ' ') %>
+
+% end
+% end
+% if action.examples
+EXAMPLES
+--------
+<%= action.examples %>
+% end
+% if action.notes
+NOTES
+-----
+<%= action.notes %>
+
+% end
+% unless action.authors.empty?
+AUTHOR
+------
+<%= action.authors.map {|x| " * " + x } .join("\n") %>
+
+%end
+COPYRIGHT AND LICENSE
+---------------------
+<%= action.copyright %>
+<%= action.license %>
diff --git a/lib/puppet/face/help/face.erb b/lib/puppet/face/help/face.erb
index efe5fd809..944f7a96b 100644
--- a/lib/puppet/face/help/face.erb
+++ b/lib/puppet/face/help/face.erb
@@ -1,7 +1,47 @@
-Use: puppet <%= face.name %> [options] <action> [options]
+NAME
+ <%= face.name %> -- <%= face.summary || "unknown face..." %>
-Available actions:
+% if face.synopsis
+SYNOPSIS
+<%= face.synopsis.gsub(/^/, ' ') %>
+
+% end
+% if face.description
+DESCRIPTION
+<%= face.description.chomp.gsub(/^/, ' ') %>
+
+%end
+% unless face.options.empty?
+OPTIONS
+% face.options.sort.each do |name|
+% option = face.get_option name
+<%= " " + option.optparse.join(" |" ) %>
+<%= option.desc and option.desc.gsub(/^/, ' ') %>
+
+% end
+% end
+ACTIONS
+% padding = face.actions.map{|x| x.to_s.length}.max + 2
% face.actions.each do |actionname|
% action = face.get_action(actionname)
- <%= action.name.to_s.ljust(16) %> <%= action.summary %>
+ <%= action.name.to_s.ljust(padding) %> <%= action.summary %>
% end
+
+% if face.examples
+EXAMPLES
+<%= face.examples %>
+% end
+% if face.notes
+NOTES
+<%= face.notes %>
+
+% end
+% unless face.authors.empty?
+AUTHOR
+<%= face.authors.join("\n").gsub(/^/, ' * ') %>
+
+%end
+COPYRIGHT AND LICENSE
+<%= face.copyright.gsub(/^/, ' ') %>
+<%= face.license.gsub(/^/, ' ') %>
+