X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/blobdiff_plain/a144f7c29fcefc56452ecbe13b7462b82c16006c..3c1e089deed71511a3afc918d8e3b5ce48e61169:/bin/wizard diff --git a/bin/wizard b/bin/wizard index 4eefba3..830b512 100755 --- a/bin/wizard +++ b/bin/wizard @@ -5,42 +5,35 @@ import optparse import sys # Add lib to path -sys.path.insert(0,os.path.abspath(os.path.join(__file__,'../../lib'))) +sys.path.insert(0,os.path.abspath(os.path.join(__file__,'../..'))) import wizard.command def main(): - usage = """usage: %prog [-d|--version-dir] COMMAND [ARGS] + usage = """usage: %prog [-s|--versions] COMMAND [ARGS] Wizard is a Git-based autoinstall management system for scripts. Its commands are: - info Reports information about an autoinstall - migrate Migrate autoinstalls from old format to Git-based format - summary Generate statistics about autoinstalls + info Reports information about an autoinstall + massmigrate Performs mass migration of autoinstalls of an application + migrate Migrate autoinstalls from old format to Git-based format + summary Generate statistics about autoinstalls + upgrade Upgrades an autoinstall to the latest version See '%prog help COMMAND' for more information on a specific command.""" parser = optparse.OptionParser(usage) - parser.add_option("-d", "--version-dir", dest="version_dir", + parser.disable_interspersed_args() + parser.add_option("-s", "--versions", dest="versions", default="/afs/athena.mit.edu/contrib/scripts/sec-tools/store/versions", - help="Location of parallel-find output") + help="Location of parallel-find output directory, or a file containing a newline separated list of 'all autoinstalls' (for testing).") # Find the end of the "global" options - i = 1 - try: - while not sys.argv[i] or sys.argv[i][0] == '-': - if sys.argv[i] == "-h" or sys.argv[i] == "--help": - parser.print_help() - raise SystemExit(-1) - i += 1 - except IndexError: - parser.print_help() - raise SystemExit(-1) - options, args = parser.parse_args(sys.argv[1:i+1]) - rest_argv = sys.argv[i+1:] + options, args = parser.parse_args() + rest_argv = args[1:] command = args[0] # shouldn't fail if command == "help": try: - getattr(wizard.command, rest_argv[0])(['-h'], options) + getattr(wizard.command, rest_argv[0]).main(['-h'], options) except AttributeError: parser.error("invalid action") except IndexError: @@ -48,9 +41,10 @@ See '%prog help COMMAND' for more information on a specific command.""" raise SystemExit(-1) # Dispatch commands try: - getattr(wizard.command, command).main(rest_argv, options) + command_module = getattr(wizard.command, command) except AttributeError: parser.error("invalid action") + command_module.main(rest_argv, options) if __name__ == "__main__": main()