summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2010-04-09 15:49:23 -0700
committerLuke Kanies <luke@puppetlabs.com>2010-04-09 15:49:23 -0700
commitedef6478e0cc47c0d2db0198fcc54897f85657bb (patch)
tree8b89fa16f41d91687e113362c77d54e96e1d54b7 /bin
parentfff8d0465c1674f111b60c313fcdca6613262a85 (diff)
downloadpuppet-edef6478e0cc47c0d2db0198fcc54897f85657bb.tar.gz
puppet-edef6478e0cc47c0d2db0198fcc54897f85657bb.tar.xz
puppet-edef6478e0cc47c0d2db0198fcc54897f85657bb.zip
Fixing 'puppet' to directly run manifests
It was previously requiring that you specify an application name, thus breaking the ability to easily run commands like: puppet ~/bin/test.pp Or even having '#/usr/bin/env puppet --verbose' in the first line of an executable script and having that work. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppet7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/puppet b/bin/puppet
index f22989815..cffa89135 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -7,7 +7,12 @@ 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[/^-/] ? nil : ARGV.shift # subcommand?
+command_name = ARGV.empty? || ARGV.first[/^-/] || ARGV.first =~ /\.pp/ || ARGV.first =~ /\.rb/ ? nil : ARGV.shift # subcommand?
+
+if command_name.nil? # It's old-style puppet, executing something
+ command_name = "main"
+end
+
if command_name.nil? # main
puts usage, available
elsif builtins.include?(command_name) #subcommand