<%# encoding: UTF-8%>
puppet-<%= face.name %>(8) -- <%= face.summary || "Undocumented subcommand." %>
<%= '=' * (_erbout.length - 1) %>

<% if face.synopsis -%>
SYNOPSIS
--------
<%= face.synopsis %>

<% end
   if face.description -%>
DESCRIPTION
-----------
<%= face.description.strip %>

<% end -%>
OPTIONS
-------
Note that any setting that's valid in the configuration
file is also a valid long argument, although it may or may not be
relevant to the present action. For example, `server` and `run_mode` are valid
settings, so you can specify `--server <servername>`, or
`--run_mode <runmode>` as an argument.

See the configuration file documentation at
<https://docs.puppetlabs.com/puppet/latest/reference/configuration.html> for the
full list of acceptable parameters. A commented list of all
configuration options can also be generated by running puppet with
`--genconfig`.

* --render-as FORMAT:
  The format in which to render output. The most common formats are `json`,
  `s` (string), `yaml`, and `console`, but other options such as `dot` are
  sometimes available.
* --verbose:
  Whether to log verbosely.
* --debug:
  Whether to log debug information.
<% unless face.display_global_options.empty?
     face.display_global_options.uniq.sort.each do |name|
		option = name
		desc = Puppet::Util::Docs.scrub(Puppet.settings.setting(option).desc)
		type = Puppet.settings.setting(option).default
		type ||= Puppet.settings.setting(option).type.to_s.upcase -%>
<%= "* --#{option} #{type}" %>:
<%= (desc || 'Undocumented setting.').gsub(/^/, '  ') %>
<%   end
   end -%>
<% unless face.options.empty?
     face.options.sort.each do |name|
       option = face.get_option name -%>
<%= "* " + option.optparse.join(" | " ) %>:
<%= (option.description || option.summary || "Undocumented option.").gsub(/^/, '  ') %>
<%   end
   end -%>

ACTIONS
-------
<% face.actions.each do |actionname|
     action = face.get_action(actionname) -%>
* `<%= action.name.to_s %>` - <%= action.summary %>:
<%   if action.synopsis -%>
  `SYNOPSIS`

  <%= action.synopsis %>

<%   end -%>
  `DESCRIPTION`

<%   if action.description -%>
<%= action.description.gsub(/^/, '  ') %>
<% else -%>
  <%= action.summary || "Undocumented action." %>
<%   end -%>

<%   unique_options = action.options - face.options
	 unique_display_global_options = action.display_global_options - face.display_global_options
     unless unique_options.empty? and unique_display_global_options.empty? -%>
  `OPTIONS`
<%      unique_display_global_options.uniq.sort.each do |name|
		  option = name
		  desc = Puppet::Util::Docs.scrub(Puppet.settings.setting(option).desc)
		  type = Puppet.settings.setting(option).default
		  type ||= Puppet.settings.setting(option).type.to_s.upcase -%>
  <%= "<--#{option} #{type}>" %> -
<%= (desc || "Undocumented setting.").gsub(/^/, '  ') %>
<%      end -%>
<%     unique_options.sort.each do |name|
         option = action.get_option name
         text = (option.description || option.summary || "Undocumented option.").chomp + "\n" -%>
  <%= '<' + option.optparse.join("> | <") + '>' %> -
<%= text.gsub(/^/, '  ') %>
<%     end -%>

<%   end -%>
<%   if action.returns -%>
  `RETURNS`

<%= action.returns.gsub(/^/, '  ') %>

<%   end
     if action.notes -%>
  `NOTES`

<%= action.notes.gsub(/^/, '  ') %>

<%   end
   end
   if face.examples or face.actions.any? {|actionname| face.get_action(actionname).examples} -%>
EXAMPLES
--------
<% end
   if face.examples -%>
<%= face.examples %>

<% end
   face.actions.each do |actionname|
     action = face.get_action(actionname)
     if action.examples -%>
`<%= action.name.to_s %>`

<%= action.examples.strip %>

<%   end
   end -%>

<% if face.notes or face.respond_to? :indirection -%>
NOTES
-----
<% if face.notes -%>
<%= face.notes.strip %>

<% end # notes
if face.respond_to? :indirection -%>
This subcommand is an indirector face, which exposes `find`, `search`, `save`,
and `destroy` actions for an indirected subsystem of Puppet. Valid termini for
this face include:

* `<%= face.class.terminus_classes(face.indirection.name).join("`\n* `") %>`

<% end # indirection
   end # notes or indirection
   unless face.authors.empty? -%>
AUTHOR
------
<%= face.authors.join("\n").gsub(/^/, ' * ') %>

<% end -%>
COPYRIGHT AND LICENSE
---------------------
<%= face.copyright %>
<%= face.license %>
