Фиксы ввода вывода и ls валидация параметров
This commit is contained in:
+12
-2
@@ -108,13 +108,22 @@ reg("ls", function(a)
|
||||
local opts = {}
|
||||
for i = 1, #a do
|
||||
if a[i]:sub(1, 1) == "-" then
|
||||
opts[a[i]] = true
|
||||
local opt = a[i]
|
||||
for j = 2, #opt do
|
||||
local c = opt:sub(j, j)
|
||||
if c ~= "a" and c ~= "l" then
|
||||
error("ls: unknown option '" .. opt .. "'")
|
||||
end
|
||||
end
|
||||
opts[opt] = true
|
||||
else
|
||||
path = resolvePath(a[i])
|
||||
end
|
||||
end
|
||||
local cmdStr = "ls"
|
||||
if #a > 0 then cmdStr = "ls " .. table.concat(a, " ") end
|
||||
for i = 1, #a do
|
||||
cmdStr = cmdStr .. " " .. tostring(a[i])
|
||||
end
|
||||
pendingCmd = { name = "ls", opts = opts, path = path,
|
||||
prompt = curUser .. " " .. cwd .. "> " .. cmdStr }
|
||||
state = ST_WAIT_FS
|
||||
@@ -254,6 +263,7 @@ local function handleFSResponse(op, data)
|
||||
end
|
||||
|
||||
queueLines(lines)
|
||||
out[4] = ""
|
||||
pendingCmd = nil
|
||||
state = ST_IDLE
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user