Added <filename> argument to logfilesize.

This commit is contained in:
Jeremy Fincher 2003-04-14 14:53:58 +00:00
parent ea7a319157
commit 9ad27d4230

View File

@ -158,10 +158,19 @@ class MiscCommands(callbacks.Privmsg):
irc.reply(msg, 'My source is at http://www.sf.net/projects/supybot/')
def logfilesize(self, irc, msg, args):
"""takes no arguments
"""[<logfile>]
Returns the size of the various logfiles in use.
Returns the size of the various logfiles in use. If given a specific
logfile, returns only the size of that logfile.
"""
filename = privmsgs.getArgs(needed=0, optional=1)
if filename:
if not file.endswith('.log'):
irc.error(msg, 'That filename doesn\'t appear to be a log.')
return
filenames = [filename]
else:
filenames = os.listdir(conf.logDir)
result = []
for file in os.listdir(conf.logDir):
if file.endswith('.log'):