Advertisement
DOGGYWOOF

Untitled

Sep 23rd, 2024
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. -- Alternative shell from CraftOS shell
  2.  
  3. termutils = {}
  4.  
  5. termutils.clear = function()
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. end
  9.  
  10. termutils.clearColor = function()
  11. term.setTextColor(colors.white)
  12. term.setBackgroundColor(colors.black)
  13. end
  14.  
  15. function checkDisk()
  16. if not fs.exists("/disk/") then
  17. print("No disk found. Running no-os...")
  18. shell.run("no-os")
  19. return false -- Disk is not found
  20. end
  21. return true -- Disk is found
  22. end
  23.  
  24. function input()
  25. term.setTextColor(colors.yellow)
  26. local dir = shell.dir().."".."> "
  27. write(dir)
  28. termutils.clearColor()
  29. local command = io.read()
  30.  
  31. if command and command ~= "" then
  32. shell.run(command)
  33. end
  34. end
  35.  
  36. termutils.clear()
  37. print("Doggy OS has booted without any issues")
  38.  
  39. while true do
  40. if not checkDisk() then
  41. break -- Exit the loop if no disk is found
  42. end
  43.  
  44. input() -- Only prompt for input if disk is found
  45. end
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement