import os import console def get_app_class(template): class App(template): def F_main(self): if len(self.argv) == 1: path = "." else: path = self.argv[1] try: for file in os.listdir(path): console.write_str(self.console, file + "\n") except OSError as e: try: os.stat(path) console.write_str(self.console, path + "\n") except OSError: console.write_str(self.console, f"ls: cannot access '{path}': No such file or directory\n") self.exit() return App