]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/blacklist.py
Convert ad hoc shell calls to singleton instance; fix upgrade bug.
[wizard.git] / wizard / command / blacklist.py
index 36b2a9864ef19f4be057074fcfeb4a4195dc404a..535fdb307b46026c6e64abb356fe873256367f51 100644 (file)
@@ -1,30 +1,25 @@
-import logging
 import os
-import optparse
-import sys
-import distutils.version
 
-from wizard import command, deploy, git, shell, util
+from wizard import command, shell, util
 
 def main(argv, baton):
     options, args = parse_args(argv, baton)
-    if not args:
-        reason = ""
-    else:
-        reason = args[0]
-    sh = shell.Shell()
+    reason = args[0]
+    # XXX: this should be abstracted away!
     if os.path.exists(".git/WIZARD_REPO"):
-        util.chdir(sh.eval('git', 'config', 'remote.origin.url'))
+        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]
+    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) > 1:
+    if len(args) > 2:
         parser.error("too many arguments")
+    if len(args) < 1:
+        parser.error("must specify reason")
     return options, args