--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pgtool Tue May 06 18:37:41 2014 +0200
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+
+"""
+Wrapper script for pgtoolkit tools.
+
+Usage:
+
+ pgtool --list
+ List all available tools.
+
+ pgtool <tool_name> <arg_1> <arg_2> ...
+ Run tool. All args except first one are forwarded to the tool.
+
+ pgtool schemadiff db1 db2
+ E.g. run schemadiff between db1 and db2.
+
+ pgtool schemadiff --help
+ Get help for tool parameters.
+
+"""
+
+import pgtoolkit.tools
+import sys
+from importlib import import_module
+
+
+if len(sys.argv) < 2:
+ print(__doc__, end='')
+ sys.exit()
+
+if sys.argv[1] == '--list':
+ for tool in pgtoolkit.tools.__all__:
+ print(tool)
+ sys.exit()
+
+tool = sys.argv[1]
+tool_args = sys.argv[2:]
+
+module = import_module('pgtoolkit.tools.' + tool)
+
+tool = module.cls()
+tool.init(tool_args)
+tool.main()
+