[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Daniel Pittman daniel at puppetlabs.com
Tue May 10 08:18:53 UTC 2011


The following commit has been merged in the experimental branch:
commit b20e9779f1c60a2a2ea1ddf21b3c5e06d8f68ac4
Author: Daniel Pittman <daniel at puppetlabs.com>
Date:   Mon May 2 12:44:13 2011 -0700

    (#7304) Improve help from `puppet foo`
    
    This addresses two of the four points: we now quote the subcommand name, and
    emit 'Usage: ' before the usage information on the puppet command line.
    
    Reviewed-By: Nick Lewis <nick at puppetlabs.com>

diff --git a/lib/puppet/face/help/global.erb b/lib/puppet/face/help/global.erb
index f4c761b..a19ce1f 100644
--- a/lib/puppet/face/help/global.erb
+++ b/lib/puppet/face/help/global.erb
@@ -1,4 +1,4 @@
-puppet <subcommand> [options] <action> [options]
+Usage: puppet <subcommand> [options] <action> [options]
 
 Available subcommands, from Puppet Faces:
 % Puppet::Face.faces.sort.each do |name|
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index 714d03f..daf49e8 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -65,7 +65,7 @@ module Puppet
           # return to the caller.  How strange we are. --daniel 2011-04-11
         else
           unless subcommand_name.nil? then
-            puts "Error: Unknown Puppet subcommand #{subcommand_name}.\n"
+            puts "Error: Unknown Puppet subcommand '#{subcommand_name}'"
           end
 
           # Doing this at the top of the file is natural, but causes puppet.rb
diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb
index 81612ee..d60bbb1 100755
--- a/spec/unit/util/command_line_spec.rb
+++ b/spec/unit/util/command_line_spec.rb
@@ -1,7 +1,7 @@
 #!/usr/bin/env rspec
 require 'spec_helper'
 
-
+require 'puppet/face'
 require 'puppet/util/command_line'
 
 describe Puppet::Util::CommandLine do
@@ -98,11 +98,9 @@ describe Puppet::Util::CommandLine do
         Puppet::Util.expects(:which).with('puppet-whatever').returns(nil)
         commandline.expects(:system).never
 
-        text = Puppet::Face[:help, :current].help
-        commandline.expects(:puts).with { |x| x =~ /Unknown Puppet subcommand/ }
-        commandline.expects(:puts).with text
-
-        commandline.execute
+        expect {
+          commandline.execute
+        }.to have_printed(/Unknown Puppet subcommand 'whatever'/)
       end
     end
   end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list