From: Michael D. Lowis Date: Tue, 4 Nov 2014 17:54:26 +0000 (-0500) Subject: Fixed argument handling for defines and profiles X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=f1a522b4aed7c58ce3c8467ff8a00f00c3e27e64;p=archive%2Fbuild-system.git Fixed argument handling for defines and profiles --- diff --git a/setup.rb b/setup.rb index e02e051..bf4e440 100644 --- a/setup.rb +++ b/setup.rb @@ -32,18 +32,14 @@ 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"] + [[: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", String, "Define or override a construction variable"], + [:profile, "-P", "--profile x,y,z", Array, "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 + opts.on( *cfg[1..-1] ) do |opt| + Opts[cfg[0]] = (opt.is_a? Array) ? (Opts[cfg[0]] + opt) : opt end end end.parse!