summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2010-04-09 14:59:09 -0700
committerLuke Kanies <luke@puppetlabs.com>2010-04-09 14:59:09 -0700
commit7c253177fbebdeb81594779bfd5b63772de09fff (patch)
treee65097831d00d12952bb1359c01f55c10b3abbe5 /bin
parenta4d1ba0534b5f6f310f8465dec5187ce7065c2bb (diff)
downloadpuppet-7c253177fbebdeb81594779bfd5b63772de09fff.tar.gz
Moving puppet back to bin
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppet18
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