Module: Puppet::Interface::TinyDocs
Overview
This module can be mixed in to provide a minimal set of documentation attributes.
Instance Method Summary (collapse)
-
- (Object) build_synopsis(face, action = nil, arguments = nil)
private
-
- (Object) description(description)
DSL
Sets the long description of this object.
-
- (Object) summary(summary)
DSL
Sets a summary of this object.
Methods included from DocGen
Instance Method Details
- (Object) build_synopsis(face, action = nil, arguments = nil) private
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/puppet/interface/documentation.rb', line 82 def build_synopsis(face, action = nil, arguments = nil) output = PrettyPrint.format do |s| s.text("puppet #{face}") s.text(" #{action}") unless action.nil? s.text(" ") .each do |option| option = get_option(option) wrap = option.required? ? %w{ < > } : %w{ [ ] } s.group(0, *wrap) do option.optparse.each do |item| unless s.current_group.first? s.breakable s.text '|' s.breakable end s.text item end end s.breakable end .sort.each do |option| wrap = %w{ [ ] } s.group(0, *wrap) do desc = Puppet.settings.setting(option).desc type = Puppet.settings.setting(option).default type ||= Puppet.settings.setting(option).type.to_s.upcase s.text "--#{option} #{type}" s.breakable end s.breakable end if arguments then s.text arguments.to_s end end end |
- (Object) description(description) DSL
Sets the long description of this object.
79 |
# File 'lib/puppet/interface/documentation.rb', line 79 attr_doc :description |
- (Object) summary(summary) DSL
Sets a summary of this object.
68 69 70 71 72 |
# File 'lib/puppet/interface/documentation.rb', line 68 attr_doc :summary do |value| value =~ /\n/ and raise ArgumentError, "Face summary should be a single line; put the long text in 'description' instead." value end |