diff options
author | Luke Kanies <luke@madstop.com> | 2005-08-29 17:12:57 +0000 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2005-08-29 17:12:57 +0000 |
commit | cdfaa5ea36926caae58f30db86ed898cde82b874 (patch) | |
tree | 3071f78fa20c14a466e420653ed5178c083ed84e /bin/puppet | |
parent | f2795359521709b5d4a64900ebed5e7b0be84c6b (diff) | |
download | puppet-cdfaa5ea36926caae58f30db86ed898cde82b874.tar.gz puppet-cdfaa5ea36926caae58f30db86ed898cde82b874.tar.xz puppet-cdfaa5ea36926caae58f30db86ed898cde82b874.zip |
adding RDoc::usage documentation to all executables
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@595 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin/puppet')
-rwxr-xr-x | bin/puppet | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/bin/puppet b/bin/puppet index 1580cb196..b86d578aa 100755 --- a/bin/puppet +++ b/bin/puppet @@ -1,4 +1,4 @@ -#!/usr/bin/ruby -w +#!/usr/bin/ruby # # = Synopsis @@ -7,11 +7,12 @@ # # = Usage # -# puppet [-V|--version] [-d|--debug] [-v|--verbose] [-l|--logfile <file>] [-h|--help] <file> +# puppet [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] +# [-l|--logfile <file>] <file> # # = Description # -# This is the standalone +puppet+ execution script; use it to execute +# This is the standalone puppet execution script; use it to execute # individual scripts that you write. If you need to execute site-wide # scripts, use +puppetd+ and +puppetmasterd+. # @@ -37,7 +38,7 @@ # = Copyright # # Copyright (c) 2005 Reductive Labs, LLC -# Licensed under the Gnu Public License +# Licensed under the GNU Public License require 'puppet' require 'puppet/server' @@ -52,13 +53,13 @@ rescue $haveusage = false end - result = GetoptLong.new( - [ "--version", "-V", GetoptLong::NO_ARGUMENT ], - [ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ], - [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], - [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ], - [ "--help", "-h", GetoptLong::NO_ARGUMENT ] - ) +result = GetoptLong.new( + [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], + [ "--help", "-h", GetoptLong::NO_ARGUMENT ], + [ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ], + [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ], + [ "--version", "-V", GetoptLong::NO_ARGUMENT ] +) debug = false verbose = false @@ -82,14 +83,21 @@ begin when "--debug" debug = true when "--logfile" - logfile = arg - else - $stderr.puts "Invalid option '#{opt}'" - Rdoc::usage(1,'usage') + # FIXME we should be able to have log.rb check the validity of the dst + case arg + when "syslog", "console", /^\//: + Puppet[:logdest] = arg + else + $stderr.puts "Invalid log destination %s" % arg + end end } rescue GetoptLong::InvalidOption => detail - RDoc::usage(1,'usage') + $stderr.puts "Try '#{$0} --help'" + #if $haveusage + # RDoc::usage(1,'usage') + #end + exit(1) end if debug @@ -98,10 +106,6 @@ elsif verbose Puppet[:loglevel] = :info end -if logfile - Puppet[:logdest] = logfile -end - begin server = Puppet::Server::Master.new( :File => ARGV.shift, @@ -125,6 +129,6 @@ begin client.getconfig client.config rescue => detail - $stderr.puts detail + Puppet.err detail exit(1) end |