]> git.mdlowis.com Git - archive/build-system.git/commitdiff
Switched to optparse
authorMichael D. Lowis <mike@mdlowis.com>
Mon, 3 Nov 2014 02:04:33 +0000 (21:04 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Mon, 3 Nov 2014 02:04:33 +0000 (21:04 -0500)
setup.rb

index 757243c8231907133d920f1385b8223394e7c4b1..e02e05193b6bcfbac2cf7ddddde73bc0f3f6662c 100644 (file)
--- 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