We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Need `toil --version`

Need `toil --version`


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/toil/utils/toilMain.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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]

{"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"}], "after_files": [{"content": "from __future__ import absolute_import, print_function\nfrom toil.version import version\nimport pkg_resources\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        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            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"}]}