LDShadowLord

TL;DR Shell

Feb 26th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.42 KB | None | 0 0
  1. local term = require("term")
  2. local component = require("component")
  3. local shell = component.shell
  4. local gpu = component.gpu -- get primary gpu component
  5. gpu.setResolution(80, 24)
  6. local w = 80
  7. local h = 24
  8. --Color Setup
  9. local aqua = 0x00FFFF
  10. local black = 0x000000
  11. local blue = 0x0000FF
  12. local fuchsia = 0xFF00FF
  13. local gray = 0x808080
  14. local green = 0x008000
  15. local lime = 0x00FF00
  16. local maroon = 0x800000
  17. local navy = 0x000080
  18. local olive = 0x808000
  19. local purple = 0x800080
  20. local red = 0xFF0000
  21. local silver = 0xC0C0C0
  22. local teal = 0x008080
  23. local white = 0xFFFFFF
  24. local yellow = 0xFFFF00
  25.  
  26. function activedirectorystring()
  27.     activedirectory = shell.getWorkingDirectory()
  28.     activedirectory = strupper(activedirectory)
  29.     if strlen(activedirectory) > 24
  30.         activedirectory = string.sub(activedirectory, strlen(activedirectory) - 24, strlen(activedirectory))
  31.     end
  32. end
  33.  
  34. activedirectorystring()
  35.  
  36. --Initial Text Color
  37. gpu.setForeground(white)
  38.  
  39. --Color Blocks
  40. gpu.setBackground(blue)
  41. gpu.fill(1, 1, w, h, " ") -- clears the screen
  42. term.setCursor(1,2)
  43. gpu.setBackground(teal)
  44. gpu.fill(1, 2, w, 1, " ")
  45. gpu.setBackground(white)
  46. gpu.fill(1, 3, w, 3, " ")
  47. gpu.setBackground(gray)
  48. gpu.fill(1, 6, w, 1, " ")
  49. gpu.setBackground(white)
  50. gpu.fill(1, 7, w, 8, " ")
  51. gpu.setBackground(gray)
  52. gpu.fill(1, 15, w, 1, " ")
  53. gpu.setBackground(white)
  54. gpu.fill(1, 16, w, 8, " ")
  55. gpu.setBackground(teal)
  56. gpu.fill(1, 24, w, 1, " ")
  57.  
  58.  
  59. --Text Blocks
  60.  
  61. --Title
  62. term.setCursor(34,1)
  63. gpu.setBackground(blue)
  64. gpu.setForeground(white)
  65. io.write("TLDR-ⓄⓈ 0.1a")
  66.  
  67. --Menu
  68. gpu.setBackground(teal)
  69. term.setCursor(4,2)
  70. io.write("F")
  71. gpu.setForeground(black)
  72. io.write("ile  ")
  73. gpu.setForeground(white)
  74. io.write("O")
  75. gpu.setForeground(black)
  76. io.write("ptions  ")
  77. gpu.setForeground(white)
  78. io.write("V")
  79. gpu.setForeground(black)
  80. io.write("iew  ")
  81. gpu.setForeground(white)
  82. io.write("T")
  83. gpu.setForeground(black)
  84. io.write("ree  ")
  85. gpu.setForeground(white)
  86. io.write("H")
  87. gpu.setForeground(black)
  88. io.write("elp")
  89. gpu.setForeground(white)
  90.  
  91. --Directory Tree
  92. gpu.setBackground(gray)
  93. gpu.setForeground(black)
  94. term.setCursor(12,6)
  95. io.write("Directory Tree")
  96.  
  97. --Active Directory
  98. gpu.setBackground(gray)
  99. gpu.setForeground(black)
  100. term.setCursor(12,60-(string.len(activedirectory)/2))
  101. io.write(activedirectory)
  102.  
  103. --Program List
  104. gpu.setBackground(gray)
  105. gpu.setForeground(black)
  106. term.setCursor(35,15)
  107. io.write("Programs")
  108.  
  109. gpu.setForeground(red)
Advertisement
Add Comment
Please, Sign In to add comment