Advertisement
DOGGYWOOF

Doggy OS V1 Shell

Sep 23rd, 2024 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 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. if not checkDisk() then
  26. return -- Exit input function if no disk is found
  27. end
  28.  
  29. term.setTextColor(colors.yellow)
  30. local dir = shell.dir().."".."> "
  31. write(dir)
  32. termutils.clearColor()
  33. command = io.read()
  34.  
  35. if command and command ~= "" then
  36. shell.run(command)
  37. end
  38. end
  39.  
  40. termutils.clear()
  41. print("Doggy OS has booted without any issues")
  42.  
  43. while true do
  44. input()
  45. end
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement