diff options
-rw-r--r-- | lib/puppet/faces/help.rb | 16 | ||||
-rw-r--r-- | spec/unit/faces/help_spec.rb | 4 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/puppet/faces/help.rb b/lib/puppet/faces/help.rb index 229a0dc81..c284433d1 100644 --- a/lib/puppet/faces/help.rb +++ b/lib/puppet/faces/help.rb @@ -1,6 +1,9 @@ require 'puppet/faces' +require 'puppet/util/command_line' Puppet::Faces.define(:help, '0.0.1') do + HelpSummaryFormat = ' %-18s %s' + summary "Displays help about puppet subcommands" action(:help) do @@ -30,7 +33,18 @@ Puppet::Faces.define(:help, '0.0.1') do message << "Available subcommands, from Puppet Faces:" Puppet::Faces.faces.sort.each do |name| face = Puppet::Faces[name, :current] - message << format(" %-15s %s", face.name, face.summary) + message << format(HelpSummaryFormat, face.name, face.summary) + end + + legacy = Puppet::Util::CommandLine.available_subcommands.reject do |appname| + Puppet::Faces.face? appname.to_sym, :current + end + unless legacy.empty? then # great victory when this is true! + message << "" + message << "Available applications, soon to be ported to Faces:" + legacy.sort.each do |appname| + message << format(HelpSummaryFormat, appname, 'REVISIT: how to summarize these?') + end end else face = Puppet::Faces[args[0].to_sym, version] diff --git a/spec/unit/faces/help_spec.rb b/spec/unit/faces/help_spec.rb index ad553dc3a..87ff67948 100644 --- a/spec/unit/faces/help_spec.rb +++ b/spec/unit/faces/help_spec.rb @@ -61,5 +61,9 @@ describe Puppet::Faces[:help, '0.0.1'] do it { should have_matching_element %r{ #{name} } } it { should have_matching_element %r{ #{name} +#{summary}} } if summary end + + Puppet::Util::CommandLine.available_subcommands do |name| + it { should have_matching_element %r{ #{name} } } + end end end |