Method: Puppet::Interface::TinyDocs#build_synopsis

Defined in:
lib/puppet/interface/documentation.rb

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



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
111
112
# File 'lib/puppet/interface/documentation.rb', line 72

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|
      next if option == :extra
      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