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 | 1d8bd0d9308413b2f0772a65ee76d69d8fa5959b (patch) | |
tree | 66117b98ff550ee0352fe3d599b98137044691da /lib/puppet/util | |
parent | 722a27fd49fc2c5ac16123e9e34967db025178f5 (diff) | |
download | puppet-1d8bd0d9308413b2f0772a65ee76d69d8fa5959b.tar.gz puppet-1d8bd0d9308413b2f0772a65ee76d69d8fa5959b.tar.xz puppet-1d8bd0d9308413b2f0772a65ee76d69d8fa5959b.zip |
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 'lib/puppet/util')
-rw-r--r-- | lib/puppet/util/command_line.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb index 59454364c..ba474df91 100644 --- a/lib/puppet/util/command_line.rb +++ b/lib/puppet/util/command_line.rb @@ -2,12 +2,10 @@ module Puppet module Util module CommandLine def self.shift_subcommand_from_argv( argv = ARGV, stdin = STDIN ) - if ! argv.first - "main" unless stdin.tty? # ttys get usage info - elsif argv.first =~ /^-|\.pp$|\.rb$/ - "main" - else - argv.shift + case argv.first + when nil; "apply" unless stdin.tty? # ttys get usage info + when /^-|\.pp$|\.rb$/; "apply" + else argv.shift end end end |