<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>pysmell/argparse.py</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,6 @@ from textwrap import dedent
 import subprocess
 import os
 from pysmell import idehelper
-from pysmell import __version__ as version
 
 class ProducesFile(object):
     def __init__(self, *files):
@@ -218,31 +217,15 @@ class FunctionalTest(unittest.TestCase):
 
 
     def testNoArgs(self):
-        proc = subprocess.Popen([&quot;pysmell&quot;], stdout=subprocess.PIPE)
+        proc = subprocess.Popen([&quot;pysmell&quot;], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         proc.wait()
-        stdout = proc.stdout.read()
+        stderr = proc.stderr.read()
         expected = dedent(&quot;&quot;&quot;\
-        PySmell %s
-
-        usage: pysmell package [package, ...] [-x excluded, ...] [options]
-
-        Generate a PYSMELLTAGS file with information about the Python code contained
-        in the specified packages (recursively). This file is then used to
-        provide autocompletion for various IDEs and editors that support it.
-
-        Options:
-
-            -x args   Will not analyze files in directories that match the argument.
-                      Useful for excluding tests or version control directories.
-
-            -o FILE   Will redirect the output to FILE instead of PYSMELLTAGS
-
-            -t        Will print timing information.
-
-            -v        Verbose mode; useful for debugging
-
-        &quot;&quot;&quot; % version).splitlines()
-        self.assertEquals(stdout.splitlines(), expected)
+        usage: pysmell [-h] [-v] [-x [package [package ...]]] [-o OUTPUT] [-t] [-d]
+                       package [package ...]
+        pysmell: error: too few arguments
+        &quot;&quot;&quot;)
+        self.assertEquals(stderr, expected)
 
 
     def DONTtestDunderAll(self):</diff>
      <filename>Tests/test_tags.py</filename>
    </modified>
    <modified>
      <diff>@@ -9,11 +9,14 @@
 
 # Released subject to the BSD License 
 
-import sys, os
+import os
+from textwrap import dedent
 from pprint import pprint
 
 from pysmell.codefinder import ModuleDict, processFile
 from pysmell.idehelper import findRootPackageList
+
+from pysmell import argparse
  
 version = __import__('pysmell').__version__
 
@@ -81,50 +84,33 @@ def process(argList, excluded, output, verbose=False):
 
 
 def main():
-    fileList = sys.argv[1:]
-    if not fileList:
-        print &quot;&quot;&quot;\
-PySmell %s
-
-usage: pysmell package [package, ...] [-x excluded, ...] [options]
-
-Generate a PYSMELLTAGS file with information about the Python code contained
-in the specified packages (recursively). This file is then used to
-provide autocompletion for various IDEs and editors that support it.
-
-Options:
-
-    -x args   Will not analyze files in directories that match the argument.
-              Useful for excluding tests or version control directories.
-
-    -o FILE   Will redirect the output to FILE instead of PYSMELLTAGS
-
-    -t        Will print timing information.
-
-    -v        Verbose mode; useful for debugging
-&quot;&quot;&quot; % version
-        sys.exit(0)
-    timing = False
-    verbose = False
-    output = 'PYSMELLTAGS'
-    excluded = []
-    if '-t' in fileList:
-        timing = True
-        fileList.remove('-t')
-
-    if '-v' in fileList:
-        verbose = True
-        fileList.remove('-v')
-
-    if '-o' in fileList:
-        fileList.remove('-o')
-        output = fileList.pop()
-
-    if '-x' in fileList:
-        excluded = fileList[fileList.index('-x')+1:]
-        fileList = fileList[:fileList.index('-x')]
-    if not fileList:
-        fileList = [os.getcwd()]
+    description = dedent(&quot;&quot;&quot;\
+        Generate a PYSMELLTAGS file with information about the
+        Python code contained in the specified packages (recursively). This file is
+        then used to provide autocompletion for various IDEs and editors that
+        support it. &quot;&quot;&quot;)
+    parser = argparse.ArgumentParser(description=description, version=version)
+    parser.add_argument('fileList', metavar='package', type=str, nargs='+',
+        help='The packages to be analysed.')
+    parser.add_argument('-x', '--exclude', metavar='package', nargs='*', type=str, default=[],
+        help=dedent(&quot;&quot;&quot;Will not analyze files in directories that match the
+        argument. Useful for excluding tests or version control directories.&quot;&quot;&quot;))
+    parser.add_argument('-o', '--output', default='PYSMELLTAGS',
+        help=&quot;File to write the tags to&quot;)
+    parser.add_argument('-t', '--timing', action='store_true',
+        help=&quot;Will print timing information&quot;)
+    parser.add_argument('-d', '--debug', action='store_true',
+        help=&quot;Verbose mode; useful for debugging&quot;)
+    args = parser.parse_args()
+    fileList = args.fileList
+    excluded = args.exclude
+    timing = args.timing
+    output = args.output
+    verbose = args.debug
+
+
+    #if not fileList:
+    #    fileList = [os.getcwd()]
 
     if timing:
         import time</diff>
      <filename>pysmell/tags.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ea6fe92f5cca07cd660204e373b0ae51efb3192c</id>
    </parent>
  </parents>
  <author>
    <name>Orestis Markou</name>
    <email>orestis@orestis.gr</email>
  </author>
  <url>http://github.com/orestis/pysmell/commit/cd2f4c36bfa2d745da5c592d637fea925a118496</url>
  <id>cd2f4c36bfa2d745da5c592d637fea925a118496</id>
  <committed-date>2008-11-04T16:18:16-08:00</committed-date>
  <authored-date>2008-11-04T16:18:16-08:00</authored-date>
  <message>Removed custom handling code and used argparse.py. Oh joy.</message>
  <tree>d98ed80666513094537e240ee77e0b800075b5f7</tree>
  <committer>
    <name>Orestis Markou</name>
    <email>orestis@orestis.gr</email>
  </committer>
</commit>
