]> git.mdlowis.com Git - archive/build-system.git/commitdiff
Fixed argument handling for defines and profiles master
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 4 Nov 2014 17:54:26 +0000 (12:54 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 4 Nov 2014 17:54:26 +0000 (12:54 -0500)
setup.rb

index e02e05193b6bcfbac2cf7ddddde73bc0f3f6662c..bf4e440d3e37f9438a76c93f206f5b9a0d2d5a41 100644 (file)
--- 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!