Module: Puppet::Interface::TinyDocs

Extended by:
DocGen
Included in:
FullDocs, Option
Defined in:
lib/puppet/interface/documentation.rb

Overview

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

Instance Method Summary collapse

Methods included from DocGen

attr_doc, strip_whitespace

Instance Method Details

#build_synopsis(face, action = nil, arguments = nil) ⇒ Object

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.



71
72
73
74
75
76
77
78
79
80
81
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
# File 'lib/puppet/interface/documentation.rb', line 71

def build_synopsis(face, action = nil, arguments = nil)
  PrettyPrint.format do |s|
    s.text("puppet #{face}")
    s.text(" #{action}") unless action.nil?
    s.text(" ")

    options.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

    display_global_options.sort.each do |option|
      wrap = %w{ [ ] }
      s.group(0, *wrap) do
        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

#description(description) ⇒ Object

Sets the long description of this object.

Parameters:

  • description (String)

    The description of this object.



68
# File 'lib/puppet/interface/documentation.rb', line 68

attr_doc :description

#summary(summary) ⇒ Object

Sets a summary of this object.



57
58
59
60
61
# File 'lib/puppet/interface/documentation.rb', line 57

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