#!/usr/bin/env micropython LOG_PATH = os.path.join(os.getenv("HOME", "/tmp"), ".fuse.log") file1 = "hello world" def log(msg): open(LOG_PATH, "a").write(msg + "\n") def getattr(path): return {"16877 2 1000 1000 4096 8" if path == "/" else f"33188 1 1000 1000 {len(file1)} 1"} if path in ["/", "/file1"] else None def readdir(): print("file1") def read(path): print(file1) if path == "/file1" else sys.exit(1) log(" ".join(sys.argv)) if len(sys.argv) < 2: sys.exit(1) cmd, path = sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else None if cmd == "readdir": readdir() elif cmd == "getattr": print(getattr(path)) if getattr(path) else sys.exit(1) elif cmd == "read": read(path) else: sys.exit(1)