def help(user): """Show help.""" tools.writeln( """ type commands to list all available commands. man <command> will display the command's doc string """)
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 ))
def _acquire_lock(self): if self.disable_lock: return timeout = self._lock_timeout if os.path.exists(self.lockpath): tools.writeln("authorized_keys is locked!") while os.path.exists(self.lockpath): time.sleep(0.01) timeout -= 1 if timeout <= 0: tools.writeln("Force removing authorized_keys lock") os.remove(self.lockpath) open(self.lockpath, "w").close()