]> scripts.mit.edu Git - wizard.git/blob - wizard/command/blacklist.py
8665524349f051127828d0c99af217df78bcc3c1
[wizard.git] / wizard / command / blacklist.py
1 import os
2
3 from wizard import command, shell, util
4
5 def main(argv, baton):
6     options, args = parse_args(argv, baton)
7     reason = args[0]
8     sh = shell.Shell()
9     # XXX: this should be abstracted away!
10     if os.path.exists(".git/WIZARD_REPO"):
11         util.chdir(sh.eval('git', 'config', 'remote.origin.url'))
12     open('.scripts/blacklisted', 'w').write(reason + "\n")
13
14 def parse_args(argv, baton):
15     usage = """usage: %prog blacklist [ARGS] REASON
16
17 Touches .scripts/blacklisted so that we don't attempt
18 to upgrade the script in the future."""
19     parser = command.WizardOptionParser(usage)
20     options, args = parser.parse_all(argv)
21     if len(args) > 2:
22         parser.error("too many arguments")
23     if len(args) < 1:
24         parser.error("must specify reason")
25     return options, args
26