View difference between Paste ID: qLc2MSXJ and nMFs8z0r
SHOW: | | - or go back to the newest paste.
1-
shell.run("delete startup")
1+
2-
shell.run("pastebin get nbXu8ZJu startup")
2+
3
local w,h = term.getSize()
4
5
function printCentered( y,s )
6
   local x = math.floor((w - string.len(s)) / 2)
7
   term.setCursorPos(x,y)
8
   term.clearLine()
9
   term.write( s )
10
end
11
12
local nOption = 1
13
14
local function drawMenu()
15
   term.clear()
16
   term.setCursorPos(1,1)
17
   term.write("An Update Is Available)")
18
term.setCursorPos(1,2)
19-
   term.write("Cat OS 0.2.1 ALPHA ")
19+
20
   if nOption == 1 then
21-
shell.run("id")
21+
   term.write("Yes")
22
   elseif nOption == 2 then
23
   term.write("No")
24
else
25-
   term.write("Command")
25+
26
27-
   term.write("Files")
27+
28-
elseif nOption == 3 then
28+
29-
   term.write("Shutdown")
29+
30-
elseif nOption == 4 then
30+
31-
   term.write("Uninstall")
31+
32
   printCentered( math.floor(h/2) - 3, "")
33
   printCentered( math.floor(h/2) - 2, "Would you like to update Now ?" )
34
   printCentered( math.floor(h/2) - 1, "")
35
   printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[  Yes   ]") or "Yes" )
36
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[  No    ]") or "No" )
37
   printCentered( math.floor(h/2) + 4, "")
38
end
39
40
--Display
41-
   printCentered( math.floor(h/2) - 2, "Cat OS Main Menu" )
41+
42
drawFrontend()
43-
   printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[  Command  ]") or "Command" )
43+
44-
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[   Files   ]") or "Files" )
44+
45-
   printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Shutdown  ]") or "Shutdown" )
45+
46-
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ Uninstall ]") or "Uninstall" )
46+
47
  local key = p
48
  if key == 17 or key == 200 then
49
50
   if nOption > 1 then
51
    nOption = nOption - 1
52
    drawMenu()
53
    drawFrontend()
54
   end
55
  elseif key == 31 or key == 208 then
56
  if nOption < 2 then
57
  nOption = nOption + 1
58
  drawMenu()
59
  drawFrontend()
60
end
61
elseif key == 28 then
62
    --End should not be here!!
63
break
64
end --End should be here!!
65
end
66-
  if nOption < 4 then
66+
67
term.clear()
68
69
--Conditions
70
if nOption  == 1 then
71
shell.run("pastebin run YH9cN6Aa")
72
elseif nOption == 2 then
73
shell.run(".os/main")
74
75
print("Error this is not supposed to happen error code 001")
76
end