Added filename option for specifying what users.conf file to use.

This commit is contained in:
Jeremy Fincher 2003-10-02 05:10:51 +00:00
parent 76febf41ec
commit 6fdde226c7

View File

@ -34,12 +34,12 @@ import supybot
from fix import * from fix import *
from questions import * from questions import *
import os
import sys import sys
import optparse import optparse
import conf import conf
import debug import debug
import ircdb
debug.minimumPriority = 'high' debug.minimumPriority = 'high'
@ -56,6 +56,11 @@ def main():
dest='capabilities', metavar='CAPABILITY', dest='capabilities', metavar='CAPABILITY',
help='capability the user should have; ' help='capability the user should have; '
'this option may be given multiple times.') 'this option may be given multiple times.')
filename = os.path.join(conf.confDir, conf.userfile)
parser.add_option('-f', '--filename', action='store', default=filename,
dest='filename',
help='filename of your users.conf; '
'defaults to %s' % filename)
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if not options.name: if not options.name:
@ -77,6 +82,10 @@ def main():
else: else:
capabilities = options.capabilities capabilities = options.capabilities
conf.confDir = os.path.dirname(options.filename)
conf.userfile = os.path.basename(options.filename)
import ircdb
try: try:
# First, let's check to see if the user is already in the database. # First, let's check to see if the user is already in the database.
_ = ircdb.users.getUser(name) _ = ircdb.users.getUser(name)