mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-12-14 01:55:46 +00:00
25 lines
526 B
Lua
25 lines
526 B
Lua
local args = { ... }
|
|
local fs = require("fs")
|
|
local term = require("term")
|
|
local colors = require("colors")
|
|
local dir = shell.getDir()
|
|
|
|
if args[1] then
|
|
dir = shell.resolve(args[1])
|
|
end
|
|
|
|
if not fs.isDir(dir) then
|
|
error("No such directory: " .. dir, 0)
|
|
return false
|
|
end
|
|
|
|
local files = fs.list(dir)
|
|
for k, v in ipairs(files) do
|
|
if fs.isDir(fs.combine(dir, v)) then
|
|
term.setForeground(colors.lightBlue)
|
|
print(v .. "/")
|
|
else
|
|
term.setForeground(colors.white)
|
|
print(v)
|
|
end
|
|
end
|