ocarina/src/core/help.py

39 lines
877 B
Python

# This is a simple test plugin, to make sure everything is working
__author__="bjschuma"
__date__ ="$Jan 20, 2010 8:01:55 PM$"
from bt.message import write
from bt import plugin
from manager import manager
class Plugin(plugin.Plugin):
def __init__(self):
plugin.Plugin.__init__(self)
self.help = "Returns a short description of the plugin"
def run(self, args=None):
if args == None:
plugin = "help"
else:
plugin = args[0]
module = None
if (plugin in manager.enabled.keys()) == True:
module = manager.enabled[plugin]
elif (plugin in manager.disabled.keys()) == True:
module = manager.disabled[plugin]
else:
message = "Plugin "+plugin+" does not appear to exist."
try:
if not module == None:
message = module.gethelp()
write(message)
return message
except:
write("Plugin "+plugin+" has no help message.")
return ""