chiark / gitweb /
Allow command line override to acrobat config
authorRichard Kettlewell <rjk@greenend.org.uk>
Thu, 29 Oct 2009 21:33:40 +0000 (21:33 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Thu, 29 Oct 2009 21:33:40 +0000 (21:33 +0000)
acrobat.py

index 6bed11a18dcc70e92640353b39c77c269d748d4d..f500593d12232844321e78a3e49fc474a2242542 100755 (executable)
@@ -78,7 +78,7 @@ class Acrobat(SingleServerIRCBot):
            self.connection.notice(nick, msg)
 
 def main():
-    if len(sys.argv)!=2:
+    if len(sys.argv) < 2:
        print "acrobat: provide configuration module name on command line"
        sys.exit(1)
     try:
@@ -86,6 +86,10 @@ def main():
     except ImportError:
        print "acrobat: configuration module "+sys.argv[1]+".py not found"
        sys.exit(1)
+    # Override configuration items from the rest of the command line
+    for opt in sys.argv[2:]:
+        (key,value)=opt.split("=")
+        c.__dict__[key] = value
     bot = Acrobat(c)
     bot.start()