]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/database.py
Revamp database infrastructure.
[wizard.git] / wizard / command / database.py
diff --git a/wizard/command/database.py b/wizard/command/database.py
new file mode 100644 (file)
index 0000000..ee59321
--- /dev/null
@@ -0,0 +1,20 @@
+from wizard import deploy, command
+
+def main(argv, baton):
+    options, args = parse_args(argv, baton)
+    dir = args[0]
+    deployment = deploy.ProductionCopy(dir)
+    print deployment.dsn.database
+
+def parse_args(argv, baton):
+    usage = """usage: %prog database DIR
+
+Prints the name of the database an application is using.
+Maybe in the future this will print more information."""
+    parser = command.WizardOptionParser(usage)
+    options, args = parser.parse_all(argv)
+    if len(args) > 1:
+        parser.error("too many arguments")
+    if len(args) == 0:
+        parser.error("must specify directory")
+    return options, args