diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-11 10:46:08 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-12 16:12:08 -0700 |
commit | d13a938b0abc604a7802cf41ff75a30ad6ccd192 (patch) | |
tree | 7b7f58b33756efdc69926aebbb6b124d88fe2c19 | |
parent | 26db6456d22b95486646ae5b8b001acb2051c4da (diff) | |
download | puppet-d13a938b0abc604a7802cf41ff75a30ad6ccd192.tar.gz puppet-d13a938b0abc604a7802cf41ff75a30ad6ccd192.tar.xz puppet-d13a938b0abc604a7802cf41ff75a30ad6ccd192.zip |
(#6962) Initial support for legacy applications in help.
We now enumerate and print the list of legacy applications in the unadorned
help action; this allows us a path to migrating forward smoothly while still
providing a good user experience.
Paired-With: Matt Robinson <matt@puppetlabs.com>
-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 |