module Puppet::Interface::TinyDocs

This module can be mixed in to provide a minimal set of documentation attributes. @api public

Public Instance Methods

build_synopsis(face, action = nil, arguments = nil) click to toggle source

@api private

    # File lib/puppet/interface/documentation.rb
 72 def build_synopsis(face, action = nil, arguments = nil)
 73   PrettyPrint.format do |s|
 74     s.text("puppet #{face}")
 75     s.text(" #{action}") unless action.nil?
 76     s.text(" ")
 77 
 78     options.each do |option|
 79       next if option == :extra
 80       option = get_option(option)
 81       wrap = option.required? ? %w{ < > } : %w{ [ ] }
 82 
 83       s.group(0, *wrap) do
 84         option.optparse.each do |item|
 85           unless s.current_group.first?
 86             s.breakable
 87             s.text '|'
 88             s.breakable
 89           end
 90           s.text item
 91         end
 92       end
 93 
 94       s.breakable
 95     end
 96 
 97     display_global_options.sort.each do |option|
 98       wrap = %w{ [ ] }
 99       s.group(0, *wrap) do
100         type = Puppet.settings.setting(option).default
101         type ||= Puppet.settings.setting(option).type.to_s.upcase
102         s.text "--#{option} #{type}"
103         s.breakable
104       end
105       s.breakable
106     end
107 
108     if arguments then
109       s.text arguments.to_s
110     end
111   end
112 end