Skip to content

Commit 2c1b602

Browse files
committed
Update miniOS classic to 0.6.2
New features and bugfixes! Rename MiniOSNetInstall.lua to miniOSclassic_download.lua Update the downloader and change capitalisation. Add miniOS NT repo as a submodule which contains the future miniOS code.
1 parent a105593 commit 2c1b602

File tree

11 files changed

+523
-26
lines changed

11 files changed

+523
-26
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "miniOSNT"]
2+
path = miniOSNT
3+
url = https://gitlab.com/Skye/miniOS-NT.git

miniOS/colors.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
local colors = {
2+
[0] = "white",
3+
[1] = "orange",
4+
[2] = "magenta",
5+
[3] = "lightblue",
6+
[4] = "yellow",
7+
[5] = "lime",
8+
[6] = "pink",
9+
[7] = "gray",
10+
[8] = "silver",
11+
[9] = "cyan",
12+
[10] = "purple",
13+
[11] = "blue",
14+
[12] = "brown",
15+
[13] = "green",
16+
[14] = "red",
17+
[15] = "black"
18+
}
19+
20+
do
21+
local keys = {}
22+
for k in pairs(colors) do
23+
table.insert(keys, k)
24+
end
25+
for _, k in pairs(keys) do
26+
colors[colors[k]] = k
27+
end
28+
end
29+
30+
return colors

miniOS/command.lua

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ local shell = {}
66

77
local tArgs={...}
88
local continue
9-
if tArgs[1] == "-c" then continue = true table.remove(tArgs, 1) end
9+
if tArgs[1] == "-c" then continue = true table.remove(tArgs, 1)
10+
else miniOS.cmdBat = nil end
1011

1112
local function intro() print(_OSVERSION .. " [".. math.floor(computer.totalMemory()/1024).."k RAM, around "..math.floor(miniOS.freeMem/1024).."k Free]" .."\nCommand Interpreter By Skye M.\n") end
1213
if not continue then intro() end
@@ -29,7 +30,23 @@ local function runprog(file, parts)
2930
end
3031

3132
local function runbat(file, parts)
32-
error("Not yet Implemented!")
33+
if not miniOS.cmdBat then miniOS.cmdBat = {} end
34+
local lines = {}
35+
local line = ""
36+
local handle = fs.open(file)
37+
repeat
38+
local char = fs.read(handle, 1)
39+
if (char == "\n" or char == nil) then
40+
lines[#lines+1] = line
41+
if char == nil then line = nil end
42+
if char == "\n" then line = "" end
43+
else line = line .. char end
44+
until line == nil
45+
fs.close(handle)
46+
47+
--for _,l in ipairs(lines) do print(l) end
48+
miniOS.cmdBat[#miniOS.cmdBat + 1] = lines
49+
os.exit(0)
3350
end
3451

3552
local function listdrives()
@@ -145,6 +162,9 @@ local function twoFileCommandHelper(run, parts)
145162
end
146163

147164
local function runline(line)
165+
--computer.beep()
166+
checkArg(1, line, "string")
167+
--print(line)
148168
line = text.trim(line)
149169
if line == "" then return true end
150170
parts = text.tokenize(line)
@@ -234,10 +254,30 @@ end
234254
if shell.runline(table.concat(tArgs, " ")) == "exit" then return end
235255

236256
while true do
237-
term.write(filesystem.drive.getcurrent() ..">")
238-
local line = term.read(history)
239-
while #history > 10 do
240-
table.remove(history, 1)
257+
if miniOS.cmdBat and #miniOS.cmdBat == 0 then
258+
miniOS.cmdBat = nil
259+
end
260+
261+
local line
262+
if miniOS.cmdBat then
263+
while #miniOS.cmdBat > 0 do
264+
repeat
265+
line = miniOS.cmdBat[#miniOS.cmdBat][1]
266+
if line == nil then
267+
miniOS.cmdBat[#miniOS.cmdBat] = nil
268+
line = ""
269+
else
270+
table.remove(miniOS.cmdBat[#miniOS.cmdBat], 1)
271+
end
272+
until line ~= "" or #miniOS.cmdBat <= 0
273+
if line ~= "" then break end
274+
end
275+
else
276+
term.write(filesystem.drive.getcurrent() ..">")
277+
line = term.read(history)
278+
while #history > 10 do
279+
table.remove(history, 1)
280+
end
241281
end
242282
if shell.runline(line) == "exit" then return true end
243283
end

0 commit comments

Comments
 (0)