import os from wizard import command, shell, util def main(argv, baton): options, args = parse_args(argv, baton) reason = args[0] # XXX: this should be abstracted away! if os.path.exists(".git/WIZARD_REPO"): util.chdir(shell.eval('git', 'config', 'remote.origin.url')) open('.scripts/blacklisted', 'w').write(reason + "\n") def parse_args(argv, baton): usage = """usage: %prog blacklist [ARGS] REASON Touches .scripts/blacklisted so that we don't attempt to upgrade the script in the future.""" parser = command.WizardOptionParser(usage) options, args = parser.parse_all(argv) if len(args) > 2: parser.error("too many arguments") if len(args) < 1: parser.error("must specify reason") return options, args