<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>features/graph/output-file.feature</filename>
    </added>
    <added>
      <filename>features/metrics/list.feature</filename>
    </added>
    <added>
      <filename>features/metrics/output-file.feature</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -86,6 +86,13 @@ setup your source tree in order to use the GCC extractor.
   extractor.type: string, extractor =~ /\A\w+\Z/
   extractor.default: 'Doxyparse'
 
+=item --output &lt;file&gt;
+
+Use a file as output
+
+=for Euclid:
+  file.type: writeable
+
 =item --help
 
 Displays help on command line syntax and options.
@@ -190,6 +197,9 @@ $output-&gt;cluster($ARGV{'--cluster'});
 $output-&gt;group_by_module($ARGV{'--modules'});
 
 $extractor-&gt;process(@{$ARGV{'&lt;input&gt;'}});
+
+open STDOUT, '&gt;', $ARGV{'--output'} if $ARGV{'--output'};
 print $output-&gt;string;
+close STDOUT;
 
 exit(0);</diff>
      <filename>egypt-graph</filename>
    </modified>
    <modified>
      <diff>@@ -52,10 +52,13 @@ Tells egypt which source code directory(ies) you want to parse.
 =for Euclid:
   input.type: readable
 
-=item --file &lt;file&gt;
+=item --output &lt;file&gt;
 
 Use a file as output
 
+=for Euclid:
+  file.type: writeable
+
 =back
 
 =head1 OUTPUT FORMAT
@@ -90,20 +93,13 @@ if($ARGV{'&lt;input&gt;'} =~ /^\s*$/){
     exit(0);
 }
 
-if($ARGV{'--file'}){
-    open (OUTPUT, &quot;&gt;&gt;$ARGV{'--file'}&quot;) or die &quot;Can't open file\n&quot;;
-}
-else{
-    open (OUTPUT, &quot;&gt;&amp;STDOUT&quot;);
-}
-
 my $extractor = Egypt::Extractor-&gt;load($ARGV{'--extractor'});
 my $metrics = Egypt::Metrics-&gt;new(model =&gt; $extractor-&gt;model);
 
 $extractor-&gt;process(@{$ARGV{'&lt;input&gt;'}});
 
-print OUTPUT $metrics-&gt;report;
-close(OUTPUT);
+open STDOUT, '&gt;', $ARGV{'--output'} if $ARGV{'--output'};
+print $metrics-&gt;report;
+close STDOUT;
 
 exit(0);
-</diff>
      <filename>egypt-metrics</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,7 @@ end
 After do
   FileUtils.rm_f('tmp.out')
   FileUtils.rm_f('tmp.err')
+  FileUtils.rm_f(Dir.glob('*.tmp'))
   FileUtils.cd(saved_dir)
   ENV['PATH'] = saved_path
   ENV['PERL5LIB'] = saved_perl5lib
@@ -43,6 +44,10 @@ Then /^the exit status must be (.+)$/ do |n|
   @exit_status.should == n.to_i
 end
 
+Then /^the exit status must not be (.+)$/ do |n|
+  @exit_status.should_not == n.to_i
+end
+
 Then /^egypt must report that &quot;([^\&quot;]*)&quot; is part of &quot;([^\&quot;]*)&quot;$/ do |func,mod|
   line = (0...(@stdout.size)).find { |i| @stdout[i] =~ /subgraph &quot;cluster_#{mod}&quot;/ }
   found = false
@@ -69,6 +74,13 @@ Then /^the output must not match &quot;([^\&quot;]*)&quot;$/ do |pattern|
   @stdout.select { |item| item.match(pattern) }.should have(0).items
 end
 
+Then /^the output from &quot;(.+)&quot; must match &quot;([^\&quot;]*)&quot;$/ do |file, pattern|
+  @out = File.readlines(file)
+  if @out.select {|item| item.match(pattern)}.size == 0
+    raise OutputDoesNotMatch.new(@out, @stderr)
+  end
+end
+
 Then /^egypt must emit a warning matching &quot;([^\&quot;]*)&quot;$/ do |pattern|
   @stderr.select {|item| item.match(pattern)}.should have_at_least(1).items
 end</diff>
      <filename>features/step_definitions/egypt_steps.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>features/metrics.feature</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>67ad2e0f94d8fa814ebe92e6397d21d1a0729e7a</id>
    </parent>
  </parents>
  <author>
    <name>Joenio Costa</name>
    <email>joenio@perl.org.br</email>
  </author>
  <url>http://github.com/terceiro/egypt/commit/fba75fbe35d4716f67a0f858c63e6ca948e11130</url>
  <id>fba75fbe35d4716f67a0f858c63e6ca948e11130</id>
  <committed-date>2009-10-15T19:54:40-07:00</committed-date>
  <authored-date>2009-10-15T13:03:20-07:00</authored-date>
  <message>Command line argument for output file</message>
  <tree>e57379a8c99412227d4f3c329839d6689f530317</tree>
  <committer>
    <name>Antonio Terceiro</name>
    <email>terceiro@softwarelivre.org</email>
  </committer>
</commit>
