1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 14:43:22 +00:00
CC-Tweaked/src/main/resources/assets/computercraft/lua/rom/programs/delete.lua
SquidDev 86e0330100 Lint bios and the rom (#321)
We now use illuaminate[1]'s linting facilities to check the rom and
bios.lua for a couple of common bugs and other problems.

Right now this doesn't detect any especially important bugs, though it
has caught lots of small things (unused variables, some noisy code). In
the future, the linter will grow in scope and features, which should
allow us to be stricter and catch most issues.

As a fun aside, we started off with ~150 bugs, and illuaminate was able
to fix all but 30 of them, which is pretty neat.

[1]: https://github.com/SquidDev/illuaminate
2019-12-03 23:26:13 +00:00

21 lines
465 B
Lua

local args = table.pack(...)
if args.n < 1 then
print("Usage: rm <paths>")
return
end
for i = 1, args.n do
local files = fs.find(shell.resolve(args[i]))
if #files > 0 then
for _, file in ipairs(files) do
local ok, err = pcall(fs.delete, file)
if not ok then
printError((err:gsub("^pcall: ", "")))
end
end
else
printError(args[i] .. ": No matching files")
end
end