puppet --help should show generic usage, not puppet apply's help
Signed-off-by: Jesse Wolfe <[email protected]>
---
lib/puppet/util/command_line.rb | 3 +++
spec/unit/util/command_line.rb | 8 ++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index bc870be..7c3b066 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -4,6 +4,9 @@ module Puppet
def self.shift_subcommand_from_argv( argv = ARGV, stdin = STDIN )
if ! argv.first
"apply" unless stdin.tty? # ttys get usage info
+ elsif argv.first == "--help"
+ # help should give you usage, not the help for `puppet
apply`
+ nil
elsif argv.first =~ /^-|\.pp$|\.rb$/
"apply"
else
diff --git a/spec/unit/util/command_line.rb b/spec/unit/util/command_line.rb
index b8fd876..265535b 100644
--- a/spec/unit/util/command_line.rb
+++ b/spec/unit/util/command_line.rb
@@ -51,6 +51,14 @@ describe Puppet::Util::CommandLine do
args.should == %w( - )
end
+ it "should return nil if the first argument is --help" do
+ args = %w( --help )
+ command = Puppet::Util::CommandLine.shift_subcommand_from_argv( args,
@tty )
+
+ command.should == nil
+ end
+
+
it "should return nil if there are no arguments on a tty" do
args = []
command = Puppet::Util::CommandLine.shift_subcommand_from_argv( args,
@tty )
--
1.6.3.3
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.