Skip to content

Instantly share code, notes, and snippets.

@rubenwardy
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenwardy/e2f1f09fa0e0c8545850 to your computer and use it in GitHub Desktop.
Save rubenwardy/e2f1f09fa0e0c8545850 to your computer and use it in GitHub Desktop.
local done = 0
local failed = 0
local notfound = 0
local uptodate = 0
local function run_query_wrapper(query)
if query:sub(#query) == "?" then
query = query:sub(1, #query - 1)
if not options.yes then
print("Skipping optional mod " .. query)
return
end
end
local status, msg = mtpm.run_query(query)
if msg then
print(msg)
end
if status == 0 then
failed = failed + 1
elseif status == 1 then
done = done + 1
elseif status == 2 then
uptodate = uptodate + 1
elseif status == 3 then
notfound = notfound + 1
end
end
-- Read from arguments
for i = 2, #args do
run_query_wrapper(args[i])
end
-- Look for depends.txt files to read
if options.depends then
f = io.open(options.depends, "r")
for line in f:lines() do
run_query_wrapper(line:trim())
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment