summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-12 16:14:02 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-12 16:14:02 -0700
commit40adee4ade3a447a7397a71d76e042091bbbfbff (patch)
treebb169ff744c7a10772a55770ef976ce4f0e82763 /lib/puppet/interface
parent8778307ca33a637fe10b601ee737628f2e5f9fbf (diff)
parent7b4d9367b391f75983868046d30928ebc8411f50 (diff)
downloadpuppet-40adee4ade3a447a7397a71d76e042091bbbfbff.tar.gz
puppet-40adee4ade3a447a7397a71d76e042091bbbfbff.tar.xz
puppet-40adee4ade3a447a7397a71d76e042091bbbfbff.zip
Merge branch 'feature/next/6962-self-documenting-strings-actions-and-options' into next
Diffstat (limited to 'lib/puppet/interface')
-rw-r--r--lib/puppet/interface/action.rb1
-rw-r--r--lib/puppet/interface/action_builder.rb4
-rw-r--r--lib/puppet/interface/face_collection.rb12
3 files changed, 15 insertions, 2 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
index e4a37a1f7..302e61901 100644
--- a/lib/puppet/interface/action.rb
+++ b/lib/puppet/interface/action.rb
@@ -14,6 +14,7 @@ class Puppet::Interface::Action
attr_reader :name
def to_s() "#{@face}##{@name}" end
+ attr_accessor :summary
# Initially, this was defined to allow the @action.invoke pattern, which is
# a very natural way to invoke behaviour given our introspection
diff --git a/lib/puppet/interface/action_builder.rb b/lib/puppet/interface/action_builder.rb
index b08c3d023..34bb3fa44 100644
--- a/lib/puppet/interface/action_builder.rb
+++ b/lib/puppet/interface/action_builder.rb
@@ -28,4 +28,8 @@ class Puppet::Interface::ActionBuilder
option = Puppet::Interface::OptionBuilder.build(@action, *declaration, &block)
@action.add_option(option)
end
+
+ def summary(text)
+ @action.summary = text
+ end
end
diff --git a/lib/puppet/interface/face_collection.rb b/lib/puppet/interface/face_collection.rb
index 84296582c..e4eb22fa3 100644
--- a/lib/puppet/interface/face_collection.rb
+++ b/lib/puppet/interface/face_collection.rb
@@ -53,7 +53,11 @@ module Puppet::Interface::FaceCollection
def self.face?(name, version)
name = underscorize(name)
- return true if @faces[name].has_key?(version)
+
+ # Note: be careful not to accidentally create the top level key, either,
+ # because it will result in confusion when people try to enumerate the
+ # list of valid faces later. --daniel 2011-04-11
+ return true if @faces.has_key?(name) and @faces[name].has_key?(version)
# We always load the current version file; the common case is that we have
# the expected version and any compatibility versions in the same file,
@@ -106,7 +110,11 @@ module Puppet::Interface::FaceCollection
# but we don't need that right now.
#
# So, this comment is a place-holder for that. --daniel 2011-04-06
- return !! @faces[name].has_key?(version)
+ #
+ # Note: be careful not to accidentally create the top level key, either,
+ # because it will result in confusion when people try to enumerate the
+ # list of valid faces later. --daniel 2011-04-11
+ return !! (@faces.has_key?(name) and @faces[name].has_key?(version))
end
def self.register(face)