def command_HELP(self, args): # FIXME: NEED TO THINK ABOUT! args = self.splitArgs(args) if not args: self.send("Get help on what? (try 'help <foo>', 'help <foo> <bar>, " "or 'commands' for a command list)") return command = args[0] meth = self.getCommandMethod(command) if not meth: raise UsageError("no such command '%s'" % command) usage = getattr(meth, 'usage', None) if isinstance(usage, dict): if len(args) == 1: k = None # command elif len(args) == 2: k = args[1] # command arg else: k = tuple(args[1:]) # command arg subarg ... usage = usage.get(k, None) if usage: self.send("Usage: %s" % usage) else: self.send( "No usage info for " + ' '.join(["'%s'" % arg for arg in args]))
def command_HELP(self, args): # FIXME: NEED TO THINK ABOUT! args = self.splitArgs(args) if not args: self.send( "Get help on what? (try 'help <foo>', 'help <foo> <bar>, " "or 'commands' for a command list)") return command = args[0] meth = self.getCommandMethod(command) if not meth: raise UsageError("no such command '%s'" % command) usage = getattr(meth, 'usage', None) if isinstance(usage, dict): if len(args) == 1: k = None # command elif len(args) == 2: k = args[1] # command arg else: k = tuple(args[1:]) # command arg subarg ... usage = usage.get(k, None) if usage: self.send("Usage: %s" % usage) else: self.send("No usage info for " + ' '.join(["'%s'" % arg for arg in args]))