diff -r fd0a8d235c70 -r 398d483e91bb dbrtools/dbr/help.py --- a/dbrtools/dbr/help.py Wed Apr 21 22:28:52 2010 +0100 +++ b/dbrtools/dbr/help.py Sun Jun 13 15:29:20 2010 +0100 @@ -14,6 +14,8 @@ # DBR help - displays the DBR help import sys +import os +import re def main(): args = sys.argv @@ -26,11 +28,42 @@ tool.help() except ImportError: print "No help on %s\n" % args[0] - usage() + getsummary() else: - usage() + getsummary() + +def getsummary(): + debug = 0 + + print "Usage:" + modules = os.listdir(os.path.join(os.path.dirname(sys.argv[0]),'dbr')) + for module in sorted(modules): + modname = re.match('(.+)\.py$',module) + if(modname): + module = modname.group(1) + try: + tool = __import__(module) + str = tool.summary() + print "\tdbr %s\t- %s" %(module, str) + except ImportError: + if(debug): + print "Couldn't import %s" % module + except AttributeError: + if(debug): + print "Couldn't find summary in %s" % module + except NameError: #if it doesn't work... + if(debug): + print "%s looks broken" % module + except SyntaxError: #if it doesn't work... + if(debug): + print "%s looks broken" % module + + + + + +def oldusage(): -def usage(): print "Usage:" print "\tdbr intro\t- basic introduction\n" @@ -47,5 +80,9 @@ print "" print "\tdbr help - help" + +def summary(): + return "Displays the help" + def help(): - print "No help available!" \ No newline at end of file + getsummary() \ No newline at end of file