From: Richard Kettlewell Date: Thu, 29 Oct 2009 21:33:40 +0000 (+0000) Subject: Allow command line override to acrobat config X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=3e0ab193b37228fc1856d31806088248baa90818;p=irc.git Allow command line override to acrobat config --- diff --git a/acrobat.py b/acrobat.py index 6bed11a..f500593 100755 --- a/acrobat.py +++ b/acrobat.py @@ -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()