diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-04-13 14:53:44 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 748aed9a4fe70cc2ecc0c782b694114356d9eb25 (patch) | |
tree | 749b66092e2d5dfea3a6bcf442c7a9e3cbd91d69 /bin | |
parent | eafde5cacaac79da79d9d1415618801fcc37edcc (diff) | |
download | puppet-748aed9a4fe70cc2ecc0c782b694114356d9eb25.tar.gz |
Fix #3552 single executable should display usage
Added some tests to make the single executable command behavior
explicit.
Added logic to display the usage message if we're on a tty and no
arguments are passed.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/puppet | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/bin/puppet b/bin/puppet index cffa89135..2f497c5fa 100755 --- a/bin/puppet +++ b/bin/puppet @@ -7,13 +7,10 @@ builtins = Dir[File.join(absolute_appdir, '*.rb')].map{|fn| File.basename(fn, '. usage = "Usage: puppet command <space separated arguments>" available = "Available commands are: #{builtins.sort.join(', ')}" -command_name = ARGV.empty? || ARGV.first[/^-/] || ARGV.first =~ /\.pp/ || ARGV.first =~ /\.rb/ ? nil : ARGV.shift # subcommand? +require 'puppet/util/command_line' +command_line = Puppet::Util::CommandLine.shift_subcommand_from_argv -if command_name.nil? # It's old-style puppet, executing something - command_name = "main" -end - -if command_name.nil? # main +if command_name.nil? puts usage, available elsif builtins.include?(command_name) #subcommand require File.join(appdir, command_name) |