diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-06-07 16:52:56 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-06-07 16:52:56 -0700 |
| commit | 54632867f7e2b97b47b0a6855196a52eb64ea92a (patch) | |
| tree | 443b28b20b8b8b25f133c20853aaff41cc2c8c25 /lib | |
| parent | b4e9791df5c01183ff037a346361ed3667e67552 (diff) | |
| parent | 0ae4732fd9058c2ae67f664c545dbd1846cef2df (diff) | |
| download | puppet-54632867f7e2b97b47b0a6855196a52eb64ea92a.tar.gz puppet-54632867f7e2b97b47b0a6855196a52eb64ea92a.tar.xz puppet-54632867f7e2b97b47b0a6855196a52eb64ea92a.zip | |
Merge branch 'bug/2.7rc/7828-face-synopsis-generators-ram-options-together' into 2.7rc
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/interface.rb | 21 | ||||
| -rw-r--r-- | lib/puppet/interface/action.rb | 23 | ||||
| -rw-r--r-- | lib/puppet/interface/documentation.rb | 31 |
3 files changed, 33 insertions, 42 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb index 10e2ec8d7..6be8b6930 100644 --- a/lib/puppet/interface.rb +++ b/lib/puppet/interface.rb @@ -76,26 +76,7 @@ class Puppet::Interface # splits out this should merge into a module that both the action and face # include. --daniel 2011-04-17 def synopsis - output = PrettyPrint.format do |s| - s.text("puppet #{name} <action>") - s.breakable - - 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 - end - end + build_synopsis self.name, '<action>' end diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb index 748888c2e..185302b07 100644 --- a/lib/puppet/interface/action.rb +++ b/lib/puppet/interface/action.rb @@ -48,28 +48,7 @@ class Puppet::Interface::Action attr_doc :returns attr_doc :arguments def synopsis - output = PrettyPrint.format do |s| - s.text("puppet #{@face.name}") - s.text(" #{name}") unless default? - s.breakable - - 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 - end - s.text(" #{arguments}") if arguments - end + build_synopsis(@face.name, default? ? nil : name, arguments) end ######################################################################## 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 |
