summaryrefslogtreecommitdiffstats
path: root/lib/puppet/face/help/face.erb
blob: 255d3d55b39994e2cf8c1c9ac54a4557a0af6fc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<% if face.synopsis -%>
USAGE: <%= face.synopsis %>

<% end -%>
<%= (face.short_description || face.summary || "undocumented subcommand").strip %>

OPTIONS:
<%# Remove these options once we can introspect them normally. -%>
  --mode MODE                    - The run mode to use (user, agent, or master).
  --render-as FORMAT             - The rendering format to use.
  --verbose                      - Whether to log verbosely.
  --debug                        - Whether to log debug information.
<% unless face.options.empty?
     optionroom = 30
     summaryroom = 80 - 5 - optionroom
      face.options.sort.each do |name|
        option = face.get_option name -%>
<%= "  " + option.optparse.join(" | ")[0,(optionroom - 1)].ljust(optionroom) + ' - ' -%>
<%     if !(option.summary) -%>
undocumented option
<%     elsif option.summary.length <= summaryroom -%>
<%= option.summary %>
<%
       else
         words = option.summary.split
         wrapped = ['']
         i = 0
         words.each do |word|
           if wrapped[i].length + word.length <= summaryroom
             wrapped[i] << word + ' '
           else
             i += 1
             wrapped[i] = word + ' '
           end
         end
-%>
<%= wrapped.shift.strip %>
<%       wrapped.each do |line| -%>
<%= (' ' * (optionroom + 5) ) + line.strip %>
<%       end
        end
      end -%>
<% end -%>

ACTIONS:
<% padding = face.actions.map{|x| x.to_s.length}.max + 2
   summaryroom = 80 - (padding + 4)
   face.actions.each do |actionname|
     action = face.get_action(actionname) -%>
  <%= action.name.to_s.ljust(padding) + '  ' -%>
<% if !(action.summary) -%>
undocumented action
<% elsif action.summary.length <= summaryroom -%>
<%= action.summary %>
<% else
          words = action.summary.split
          wrapped = ['']
          i = 0
          words.each do |word|
            if wrapped[i].length + word.length <= summaryroom
              wrapped[i] << word + ' '
            else
              i += 1
              wrapped[i] = word + ' '
            end
          end
-%>
<%= wrapped.shift.strip %>
<%       wrapped.each do |line| -%>
<%= (' ' * (padding + 4) ) + line.strip %>
<%       end
        end
end -%>

<% if face.respond_to? :indirection -%>
TERMINI: <%= face.class.terminus_classes(face.indirection.name).join(", ") %>

<% end -%>
See 'puppet man <%= face.name %>' or 'man puppet-<%= face.name %>' for full help.