prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Need `toil --version`
  
  Need `toil --version`
  
  
  </issue>
  <code>
  [start of src/toil/utils/toilMain.py]
  1 from __future__ import absolute_import, print_function
  2 import os
  3 import sys
  4 
  5 def main():
  6     modules = loadModules()
  7     try:
  8         command = sys.argv[1]
  9     except IndexError:
  10         printHelp(modules)
  11     else:
  12         if command == '--help':
  13             printHelp(modules)
  14         else:
  15             try:
  16                 module = modules[command]
  17             except KeyError:
  18                 print("Unknown option '%s'. "
  19                       "Pass --help to display usage information.\n" % command, file=sys.stderr)
  20                 sys.exit(1)
  21             else:
  22                 del sys.argv[1]
  23                 module.main()
  24 
  25 
  26 def loadModules():
  27     # noinspection PyUnresolvedReferences
  28     from toil.utils import toilKill, toilRestart, toilStats, toilStatus, toilClean
  29     return {name[4:].lower(): module for name, module in locals().iteritems()}
  30 
  31 
  32 def printHelp(modules):
  33     usage = ("\n"
  34              "Usage: {name} COMMAND ...\n"
  35              "       {name} --help\n"
  36              "       {name} COMMAND --help\n\n"
  37              "where COMMAND is one of the following:\n\n{descriptions}\n\n")
  38     print(usage.format(
  39         name=os.path.basename(sys.argv[0]),
  40         commands='|'.join(modules.iterkeys()),
  41         descriptions='\n'.join("%s - %s" % (n, m.__doc__.strip()) for n, m in modules.iteritems())))
  42
  [end of src/toil/utils/toilMain.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/toil/utils/toilMain.py b/src/toil/utils/toilMain.py
  --- a/src/toil/utils/toilMain.py
  +++ b/src/toil/utils/toilMain.py
  @@ -1,4 +1,6 @@
   from __future__ import absolute_import, print_function
  +from toil.version import version
  +import pkg_resources
   import os
   import sys
   
  @@ -11,6 +13,11 @@
       else:
           if command == '--help':
               printHelp(modules)
  +        elif command == '--version':
  +            try:
  +                print(pkg_resources.get_distribution('toil').version)
  +            except:
  +                print("Version gathered from toil.version: "+version)
           else:
               try:
                   module = modules[command]
  
verification_info: {"golden_diff": "diff --git a/src/toil/utils/toilMain.py b/src/toil/utils/toilMain.py\n--- a/src/toil/utils/toilMain.py\n+++ b/src/toil/utils/toilMain.py\n@@ -1,4 +1,6 @@\n from __future__ import absolute_import, print_function\n+from toil.version import version\n+import pkg_resources\n import os\n import sys\n \n@@ -11,6 +13,11 @@\n     else:\n         if command == '--help':\n             printHelp(modules)\n+        elif command == '--version':\n+            try:\n+                print(pkg_resources.get_distribution('toil').version)\n+            except:\n+                print(\"Version gathered from toil.version: \"+version)\n         else:\n             try:\n                 module = modules[command]\n", "issue": "Need `toil --version`\n\nNeed `toil --version`\n\n", "before_files": [{"content": "from __future__ import absolute_import, print_function\nimport os\nimport sys\n\ndef main():\n    modules = loadModules()\n    try:\n        command = sys.argv[1]\n    except IndexError:\n        printHelp(modules)\n    else:\n        if command == '--help':\n            printHelp(modules)\n        else:\n            try:\n                module = modules[command]\n            except KeyError:\n                print(\"Unknown option '%s'. \"\n                      \"Pass --help to display usage information.\\n\" % command, file=sys.stderr)\n                sys.exit(1)\n            else:\n                del sys.argv[1]\n                module.main()\n\n\ndef loadModules():\n    # noinspection PyUnresolvedReferences\n    from toil.utils import toilKill, toilRestart, toilStats, toilStatus, toilClean\n    return {name[4:].lower(): module for name, module in locals().iteritems()}\n\n\ndef printHelp(modules):\n    usage = (\"\\n\"\n             \"Usage: {name} COMMAND ...\\n\"\n             \"       {name} --help\\n\"\n             \"       {name} COMMAND --help\\n\\n\"\n             \"where COMMAND is one of the following:\\n\\n{descriptions}\\n\\n\")\n    print(usage.format(\n        name=os.path.basename(sys.argv[0]),\n        commands='|'.join(modules.iterkeys()),\n        descriptions='\\n'.join(\"%s - %s\" % (n, m.__doc__.strip()) for n, m in modules.iteritems())))\n", "path": "src/toil/utils/toilMain.py"}]}