From edef6478e0cc47c0d2db0198fcc54897f85657bb Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 9 Apr 2010 15:49:23 -0700 Subject: 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 --- bin/puppet | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 " 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 -- cgit