diff options
author | Luke Kanies <luke@puppetlabs.com> | 2010-04-09 14:59:09 -0700 |
---|---|---|
committer | Luke Kanies <luke@puppetlabs.com> | 2010-04-09 14:59:09 -0700 |
commit | 7c253177fbebdeb81594779bfd5b63772de09fff (patch) | |
tree | e65097831d00d12952bb1359c01f55c10b3abbe5 /bin | |
parent | a4d1ba0534b5f6f310f8465dec5187ce7065c2bb (diff) | |
download | puppet-7c253177fbebdeb81594779bfd5b63772de09fff.tar.gz |
Moving puppet back to bin
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/puppet | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/puppet b/bin/puppet new file mode 100755 index 000000000..f22989815 --- /dev/null +++ b/bin/puppet @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +appdir = File.join('puppet', 'application') +absolute_appdir = $:.collect { |x| File.join(x,'puppet','application') }.detect{ |x| File.directory?(x) } +builtins = Dir[File.join(absolute_appdir, '*.rb')].map{|fn| File.basename(fn, '.rb')} + +usage = "Usage: puppet command <space separated arguments>" +available = "Available commands are: #{builtins.sort.join(', ')}" + +command_name = ARGV.empty? || ARGV.first[/^-/] ? nil : ARGV.shift # subcommand? +if command_name.nil? # main + puts usage, available +elsif builtins.include?(command_name) #subcommand + require File.join(appdir, command_name) + Puppet::Application[command_name].run +else + abort "Error: Unknown command #{command_name}.\n#{usage}\n#{available}" +end |