]> scripts.mit.edu Git - wizard.git/blobdiff - bin/wizard
Fix 'wizard' to print help.
[wizard.git] / bin / wizard
index 862e4f303a241659c1b78b50e98717983bcd2a79..958226644238013d2307ca4785b468b2bc43bcd0 100755 (executable)
@@ -5,7 +5,7 @@ import optparse
 import sys
 
 # Add lib to path
-sys.path.insert(0,os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)))))
+sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 import wizard.command
 
 def main():
@@ -30,7 +30,11 @@ See '%prog help COMMAND' for more information on a specific command."""
     # Find the end of the "global" options
     options, args = parser.parse_args()
     rest_argv = args[1:]
-    command = args[0] # shouldn't fail
+    try:
+        command = args[0]
+    except IndexError:
+        parser.print_help()
+        raise SystemExit(-1)
     if command == "help":
         try:
             getattr(wizard.command, rest_argv[0]).main(['-h'], options)