def complete(text, state): for cmd, app in active.user_apps(): if cmd.startswith(text): if not state: return cmd else: state -= 1
def commands(user): """List all commands.""" for name, app in sorted(active.user_apps()): if app.__doc__: doc = [line.strip() # Get first line with content for line in app.__doc__.split("\n") if line.strip()][0] else: doc = "%s has no doc string" % name tools.writeln("%s - %s" % ( name, doc ))