diff options
Diffstat (limited to 'lib/puppet/interface/documentation.rb')
-rw-r--r-- | lib/puppet/interface/documentation.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/puppet/interface/documentation.rb b/lib/puppet/interface/documentation.rb index fcaec2568..47e478a44 100644 --- a/lib/puppet/interface/documentation.rb +++ b/lib/puppet/interface/documentation.rb @@ -61,6 +61,37 @@ class Puppet::Interface end attr_doc :description + + 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(" ") + + 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 + + if arguments then + s.text arguments.to_s + end + end + end + end module FullDocs |