Skip to content

Commit f3d829a

Browse files
authored
miniOS Command Intepreter 0.6.1.2
1 parent 6964f2c commit f3d829a

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

miniOS/command.lua

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ local function label(parts)
5959
end
6060

6161
local function outputFile(file, paged)
62-
local handle, reason = filesystem.open(file)
63-
if not handle then
64-
error(reason, 2)
65-
end
66-
local buffer = ""
67-
repeat
68-
local data, reason = filesystem.read(handle)
69-
if not data and reason then
70-
error(reason)
71-
end
72-
buffer = buffer .. (data or "")
73-
until not data
74-
filesystem.close(handle)
75-
if paged then printPaged(buffer)
76-
else print(buffer) end
62+
local handle, reason = filesystem.open(file)
63+
if not handle then
64+
error(reason, 2)
65+
end
66+
local buffer = ""
67+
repeat
68+
local data, reason = filesystem.read(handle)
69+
if not data and reason then
70+
error(reason)
71+
end
72+
buffer = buffer .. (data or "")
73+
until not data
74+
filesystem.close(handle)
75+
if paged then printPaged(buffer)
76+
else print(buffer) end
7777
end
7878

7979
local function dir(folder)
@@ -95,9 +95,9 @@ local function moveFile(from, to, force)
9595
checkArg(1, from, "string")
9696
checkArg(2, to, "string")
9797
if fs.isDirectory(to) then
98-
if not fs.name then error("Need to specify name for destination!", 0) end
98+
if not fs.name then error("Need to specify name for destination!", 0) end
9999
to = to .. "/" .. fs.name(from)
100-
end
100+
end
101101
if fs.exists(to) then
102102
if not force then
103103
printErr("target file exists")
@@ -115,9 +115,9 @@ local function copyFile(from, to, force)
115115
checkArg(1, from, "string")
116116
checkArg(2, to, "string")
117117
if fs.isDirectory(to) then
118-
if not fs.name then error("Need to specify name for destination!", 0) end
118+
if not fs.name then error("Need to specify name for destination!", 0) end
119119
to = to .. "/" .. fs.name(from)
120-
end
120+
end
121121
if fs.exists(to) then
122122
if not force then
123123
printErr("target file exists")
@@ -163,7 +163,7 @@ local function runline(line)
163163
runprog(command, parts) return true
164164
end
165165
end
166-
if filesystem.exists(command .. ".lua") then
166+
if filesystem.exists(command .. ".lua") then
167167
if not filesystem.isDirectory(command .. ".lua") then
168168
runprog(command .. ".lua", parts)
169169
return true
@@ -177,7 +177,7 @@ local function runline(line)
177177
end
178178
--internal commands
179179
if command == "exit" then history = {} return "exit" end
180-
if command == "cls" then term.clear() return true end
180+
if command == "cls" then term.clear(); term.gpu().setForeground(0xFFFFFF); term.gpu().setBackground(0x000000) return true end
181181
if command == "ver" then print(_OSVERSION) return true end
182182
if command == "mem" then print(math.floor(computer.totalMemory()/1024).."k RAM, "..math.floor(computer.freeMemory()/1024).."k Free") return true end
183183
if command == "dir" then if parts[2] then dir(fixPath(parts[2])) else dir() end return true end

0 commit comments

Comments
 (0)