-- SimpleOS v1.0 (English Version) -- For ComputerCraft: Tweaked local function drawTitle() term.clear() term.setCursorPos(1, 1) print("=== SimpleOS 1.0 ===") print("") end local function drawMenu() drawTitle() print("[1] List all files") print("[2] Edit a file") print("[3] Run a program") print("[4] Open native shell") print("[5] Shutdown computer") print("") write("Enter option number: ") end local function listFiles() drawTitle() print("Files in root directory:") local files = fs.list("/") for i = 1, #files do if fs.isDir(files[i]) then print("[DIR] " .. files[i]) else print("[FILE] " .. files[i]) end end print("") write("Press any key to return...") os.pullEvent("key") end local function editFile() drawTitle() write("Enter filename to edit: ") local filename = read() if filename ~= "" then shell.run("edit " .. filename) end end local function runProgram() drawTitle() write("Enter program name to run: ") local prog = read() if prog ~= "" then shell.run(prog) print("") write("Press any key to return...") os.pullEvent("key") end end -- Main loop (safe, no yield error) while true do drawMenu() local input = read() if input == "1" then listFiles() elseif input == "2" then editFile() elseif input == "3" then runProgram() elseif input == "4" then drawTitle() print("Entered native shell. Type 'exit' to return.") shell.run("shell") elseif input == "5" then term.clear() term.setCursorPos(1, 1) print("Shutting down...") sleep(0.5) os.shutdown() else print("Invalid option, please try again") sleep(0.8) end end