From: Michael D. Lowis Date: Mon, 3 Nov 2014 02:04:33 +0000 (-0500) Subject: Switched to optparse X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=bc9ed182ee184b60a88d0325bef8877fd9912a69;p=archive%2Fbuild-system.git Switched to optparse --- diff --git a/setup.rb b/setup.rb index 757243c..e02e051 100644 --- a/setup.rb +++ b/setup.rb @@ -2,10 +2,9 @@ # Setup and Check Bundle Dependencies #------------------------------------------------------------------------------ DefaultDeps = [ - ['rake', '>= 0'], - ['rscons', '>= 0'], - ['rspec', '>= 0'], - ['trollop', '>= 0'] + ['rake', '>= 0'], + ['rscons', '>= 0'], + ['rspec', '>= 0'], ] # Generate a default Gemfile if none exists @@ -29,13 +28,25 @@ require_relative 'toolsets' #------------------------------------------------------------------------------ # Command Options #------------------------------------------------------------------------------ -Opts = Trollop::options do - opt :verbose, "Echo commands being executed", :short => 'v' - opt :clean, "Clean all generated files", :short => 'c' - opt :purge, "Purges all generated files and directories", :short => 'p' - opt :define, "Define or override construction variable(s)", :type => :strings, :short => 'D' - opt :profile, "Selects the profile(s) under which the project wil be built", :type => :strings, :short => 'P' -end +require 'optparse' +Opts = { :define => [], :profile => [] } +OptionParser.new do |opts| + opts.banner = "Usage: #{$PROGRAM_NAME} [options]" + [[:verbose, "-v", "--verbose", "Echo commands being executed"], + [:clean, "-c", "--clean", "Clean all generated files"], + [:purge, "-p", "--purge", "Purge all generated files and directories"], + [:define, "-D", "--define VAR", "Define or override construction variable(s)"], + [:profile, "-P", "--profile NAME", "Selects the profile(s) under which the project will be built"] + ].each do |cfg| + opts.on( *cfg[1..3] ) do |opt| + if Opts[cfg[0]] + Opts[cfg[0]] << opt + else + Opts[cfg[0]] = [opt] + end + end + end +end.parse! #------------------------------------------------------------------------------ # Environment Manager