diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-27 10:05:48 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-27 10:10:20 -0700 |
| commit | e8eb290a1681baa19ef0b035af7cf17daadc6069 (patch) | |
| tree | e94d133c7a817be600fa38902fdc96cc304b3670 /lib/puppet/interface | |
| parent | 6e152ad1d0bb34f6d24fd818b2b020d5a8dd385b (diff) | |
| download | puppet-e8eb290a1681baa19ef0b035af7cf17daadc6069.tar.gz puppet-e8eb290a1681baa19ef0b035af7cf17daadc6069.tar.xz puppet-e8eb290a1681baa19ef0b035af7cf17daadc6069.zip | |
(#6962) Finish documentation API on Face options.
This extends the last of the documentation support, down into options, so they
can be described as expected. In the process we split out the modular docs
API into a full and short version options only want short docs, but the
behaviours are identical to the full version.
Diffstat (limited to 'lib/puppet/interface')
| -rw-r--r-- | lib/puppet/interface/action.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/interface/documentation.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/interface/option.rb | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb index 18c7ab057..177df81f2 100644 --- a/lib/puppet/interface/action.rb +++ b/lib/puppet/interface/action.rb @@ -3,7 +3,7 @@ require 'puppet/interface/documentation' require 'prettyprint' class Puppet::Interface::Action - include Puppet::Interface::DocSupport + include Puppet::Interface::FullDocs def initialize(face, name, attrs = {}) raise "#{name.inspect} is an invalid action name" unless name.to_s =~ /^[a-z]\w*$/ diff --git a/lib/puppet/interface/documentation.rb b/lib/puppet/interface/documentation.rb index f3bf33da5..d0bfbb261 100644 --- a/lib/puppet/interface/documentation.rb +++ b/lib/puppet/interface/documentation.rb @@ -1,5 +1,5 @@ class Puppet::Interface - module DocSupport + module TinyDocs attr_accessor :summary def summary(value = nil) self.summary = value unless value.nil? @@ -18,6 +18,10 @@ class Puppet::Interface self.description = value unless value.nil? @description end + end + + module FullDocs + include TinyDocs attr_accessor :examples def examples(value = nil) diff --git a/lib/puppet/interface/option.rb b/lib/puppet/interface/option.rb index 3d3840ff6..493b5c3bd 100644 --- a/lib/puppet/interface/option.rb +++ b/lib/puppet/interface/option.rb @@ -1,6 +1,10 @@ require 'puppet/interface' class Puppet::Interface::Option + include Puppet::Interface::FullDocs + # For compatibility, deprecated, and should go fairly soon... + ['', '='].each { |x| alias :"desc#{x}" :"description#{x}" } + def initialize(parent, *declaration, &block) @parent = parent @optparse = [] @@ -80,7 +84,7 @@ class Puppet::Interface::Option end attr_reader :parent, :name, :aliases, :optparse - attr_accessor :required, :desc + attr_accessor :required attr_accessor :before_action def before_action=(proc) |
