Merge from trunk
[plcapi.git] / trunk / PLC / Methods / system / methodHelp.py
diff --git a/trunk/PLC/Methods/system/methodHelp.py b/trunk/PLC/Methods/system/methodHelp.py
new file mode 100644 (file)
index 0000000..22a0dc1
--- /dev/null
@@ -0,0 +1,20 @@
+from PLC.Method import Method
+from PLC.Parameter import Parameter
+
+class methodHelp(Method):
+    """
+    Returns help text if defined for the method passed, otherwise
+    returns an empty string.
+    """
+
+    roles = []
+    accepts = [Parameter(str, 'Method name')]
+    returns = Parameter(str, 'Method help')
+
+    def __init__(self, api):
+        Method.__init__(self, api)
+        self.name = "system.methodHelp"
+
+    def call(self, method):
+        function = self.api.callable(method)
+        return function.help()