make the config file argument optional.

this should probably be robustified (--config-file=foo) eventually
This commit is contained in:
Brian S. Stephan 2011-01-06 22:43:10 -06:00
parent 00d5502477
commit b487caf12d
1 changed files with 4 additions and 3 deletions

View File

@ -69,14 +69,15 @@ class DrBotIRC(irclib.IRC):
self.connections.append(c)
return c
config_file = 'dr.botzo.cfg'
# check argv
if len(sys.argv) != 2:
sys.exit("Needs one argument, the config filename")
if len(sys.argv) == 2:
config_file = sys.argv[1]
# read config file
config = ConfigParser({'debug': 'false'})
config.read(os.path.expanduser(sys.argv[1]))
config.read(os.path.expanduser(config_file))
# load necessary options
try: