]> scripts.mit.edu Git - wizard.git/blobdiff - bin/wizard
Fix misnamed variable bug.
[wizard.git] / bin / wizard
index 81599efced1b6e3c839acb0bead9cc0bf7f0f29c..6ff98a4ad3c850431a14275a623ab0c341cf4772 100755 (executable)
@@ -4,10 +4,10 @@ import os
 import optparse
 import sys
 
-# Add lib to path
 sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-import wizard.command
-from wizard.command import _command
+
+import wizard
+from wizard import command
 
 def main():
     usage = """usage: %prog COMMAND [ARGS]
@@ -15,7 +15,9 @@ def main():
 Wizard is a Git-based autoinstall management system for scripts.
 
 Its commands are:
+    errors          Lists all broken autoinstall metadata
     info            Reports information about an autoinstall
+    list            Lists autoinstalls, with optional filtering
     massmigrate     Performs mass migration of autoinstalls of an application
     migrate         Migrate autoinstalls from old format to Git-based format
     summary         Generate statistics (see help for subcommands)
@@ -27,31 +29,33 @@ See '%prog help COMMAND' for more information on a specific command."""
     parser.disable_interspersed_args()
     _, args = parser.parse_args() # no global options
     rest_argv = args[1:]
-    baton = _command.OptionBaton()
+    baton = command.OptionBaton()
     baton.add("--versions-path", dest="versions_path",
         default="/afs/athena.mit.edu/contrib/scripts/sec-tools/store/versions",
         help="Location of parallel-find output directory, or a file containing a newline separated list of 'all autoinstalls' (for testing).")
     try:
-        command = args[0]
+        command_name = args[0]
     except IndexError:
         parser.print_help()
         raise SystemExit(1)
-    if command == "help":
+    if command_name == "help":
         try:
-            get_command(rest_argv[0]).main(['--help'], baton)
-        except AttributeError:
+            help_module = get_command(rest_argv[0])
+        except ImportError:
             parser.error("invalid action")
         except IndexError:
             parser.print_help()
             raise SystemExit(1)
+        help_module.main(['--help'], baton)
     # Dispatch commands
     try:
-        command_module = get_command(command)
-    except AttributeError:
+        command_module = get_command(command_name)
+    except ImportError:
         parser.error("invalid action")
     command_module.main(rest_argv, baton)
 
 def get_command(name):
+    __import__("wizard.command." + name)
     return getattr(wizard.command, name)
 
 if __name__ == "__main__":