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