<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -20,28 +20,10 @@ module Reek
       @options = Options.new(argv)
     end
 
-    def examine_sources
-      # SMELL: Greedy Method
-      # Options.parse executes the -v and -h commands and throws a SystemExit
-      args = @options.parse
-      if args.length &gt; 0
-        @sniffer = args.sniff
-      else
-        @sniffer = Reek::Sniffer.new($stdin.to_reek_source('$stdin'))
-      end
-    end
-
-    def reek
-      examine_sources
-      puts @options.create_report(@sniffer.sniffers).report
-      return EXIT_STATUS[@sniffer.smelly? ? :smells : :success]
-    end
-
     def execute
       begin
-        return reek
-      rescue SystemExit =&gt; ex
-        return ex.status
+        cmd = @options.parse
+        return cmd.execute
       rescue Exception =&gt; error
         $stderr.puts &quot;Error: #{error}&quot;
         return EXIT_STATUS[:error]</diff>
      <filename>lib/reek/adapters/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,12 +19,13 @@ module Reek
       @quiet = false
       @show_all = false
       @format = CTX_SORT
+      @command = nil
       set_options
     end
 
     def parse
       @parser.parse!(@argv)
-      @argv
+      @command ||= ReekCommand.new(@argv, @quiet, @format, @show_all)
     end
 
     def set_options
@@ -44,12 +45,10 @@ EOB
       @parser.separator &quot;Common options:&quot;
 
       @parser.on(&quot;-h&quot;, &quot;--help&quot;, &quot;Show this message&quot;) do
-        puts @parser
-        exit(EXIT_STATUS[:success])
+        @command = HelpCommand.new(@parser)
       end
       @parser.on(&quot;-v&quot;, &quot;--version&quot;, &quot;Show version&quot;) do
-        puts &quot;#{@parser.program_name} #{Reek::VERSION}&quot;
-        exit(EXIT_STATUS[:success])
+        @command = VersionCommand.new(@parser)
       end
 
       @parser.separator &quot;\nReport formatting:&quot;
@@ -75,4 +74,44 @@ EOB
       @quiet ? QuietReport.new(sniffers, @format, @show_all) : FullReport.new(sniffers, @format, @show_all)
     end
   end
+
+  class HelpCommand
+    def initialize(parser)
+      @parser = parser
+    end
+    def execute
+      puts @parser.to_s
+      return EXIT_STATUS[:success]
+    end
+  end
+
+  class VersionCommand
+    def initialize(parser)
+      @parser = parser
+    end
+    def execute
+      puts &quot;#{@parser.program_name} #{Reek::VERSION}&quot;
+      return EXIT_STATUS[:success]
+    end
+  end
+
+  class ReekCommand
+    def initialize(args, quiet, format, show_all)
+      @args = args
+      @quiet = quiet
+      @format = format
+      @show_all = show_all
+    end
+
+    def execute
+      sniffer = @args.length &gt; 0 ?
+        @args.sniff :
+        Reek::Sniffer.new($stdin.to_reek_source('$stdin'))
+      rpt = @quiet ?
+        QuietReport.new(sniffer.sniffers, @format, @show_all) :
+        FullReport.new(sniffer.sniffers, @format, @show_all)
+      puts rpt.report
+      return EXIT_STATUS[sniffer.smelly? ? :smells : :success]
+    end
+  end
 end</diff>
      <filename>lib/reek/adapters/command_line.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>144f6682a6c1a2417a89bd9a37e286fb65c7f986</id>
    </parent>
  </parents>
  <author>
    <name>Kevin Rutherford</name>
    <email>kevin@rutherford-software.com</email>
  </author>
  <url>http://github.com/kevinrutherford/reek/commit/a27e570d69cf1b53ef30d0a3cc3615132b9b8238</url>
  <id>a27e570d69cf1b53ef30d0a3cc3615132b9b8238</id>
  <committed-date>2009-11-06T09:05:58-08:00</committed-date>
  <authored-date>2009-11-06T09:05:58-08:00</authored-date>
  <message>Inverted control out of Options</message>
  <tree>316b0b264d87f04d849b6659ceef0bd9a0a636f0</tree>
  <committer>
    <name>Kevin Rutherford</name>
    <email>kevin@rutherford-software.com</email>
  </committer>
</commit>
