<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,6 @@
 
 * added Middleware baseclass
+* Task.parse now yields opts to block for modifications
 
 == 0.18.0 / 2009-06-14
 </diff>
      <filename>tap/History</filename>
    </modified>
    <modified>
      <diff>@@ -137,12 +137,20 @@ module Tap
       # Parses the argv into an instance of self.  By default parse 
       # parses an argh then calls instantiate, but there is no requirement
       # that this occurs in subclasses.
-      def parse(argv=ARGV, app=Tap::App.instance)
-        parse!(argv.dup, app)
+      #
+      # ==== Block Overrides
+      #
+      # For convenience, parse will yield the internal ConfigParser to the
+      # block, if given.  This functionality was added to Task so they are
+      # more flexible in executable files but it is not a part of the API
+      # requirements for parse/parse!.
+      #
+      def parse(argv=ARGV, app=Tap::App.instance, &amp;block) # :yields: opts
+        parse!(argv.dup, app, &amp;block)
       end
       
       # Same as parse, but removes arguments destructively.
-      def parse!(argv=ARGV, app=Tap::App.instance)
+      def parse!(argv=ARGV, app=Tap::App.instance) # :yields: opts
         opts = ConfigParser.new
         
         unless configurations.empty?
@@ -176,6 +184,8 @@ module Tap
           opts.config.merge!(load_config(config_file))
         end
         
+        yield(opts) if block_given?
+        
         # (note defaults are not added so they will not
         # conflict with string keys from a config file)
         argv = opts.parse!(argv, :add_defaults =&gt; false)</diff>
      <filename>tap/lib/tap/task.rb</filename>
    </modified>
    <modified>
      <diff>@@ -181,6 +181,21 @@ class TaskTest &lt; Test::Unit::TestCase
     end
   end
   
+  def test_parse_yields_opts_to_block_if_given
+    instance = ParseClass.parse(['--new-flag']) do |opts|
+      opts.on &quot;--new-flag&quot; do 
+        opts['new_flag_parsed'] = true
+      end
+      
+      opts.on &quot;--another-new-flag&quot; do 
+        opts['another_new_flag_parsed'] = true
+      end
+    end
+    
+    assert_equal true, instance.config['new_flag_parsed']
+    assert_equal nil, instance.config['another_new_flag_parsed']
+  end
+  
   #
   # parse! test
   #</diff>
      <filename>tap/test/tap/task_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3cfb5db2f45cd952f1cf9f2850bceaceb1c0c3c6</id>
    </parent>
  </parents>
  <author>
    <name>Simon Chiang</name>
    <email>simon.a.chiang@gmail.com</email>
  </author>
  <url>http://github.com/bahuvrihi/tap/commit/98ef83b314de62545aa09858f30ffc7847ffd314</url>
  <id>98ef83b314de62545aa09858f30ffc7847ffd314</id>
  <committed-date>2009-06-17T20:19:06-07:00</committed-date>
  <authored-date>2009-06-17T20:19:06-07:00</authored-date>
  <message>now Task.parse yields opts to block if given</message>
  <tree>58aab55d77e8244c14d737e4f92f4fc679b52bee</tree>
  <committer>
    <name>Simon Chiang</name>
    <email>simon.a.chiang@gmail.com</email>
  </committer>
</commit>
