Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.11 #99

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions bin/mineunit
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ local args = {
Xoutput = {},
}

mineunit_version = "0.11.1"
local luaversion = (function()
local jit = rawget(_G, "jit")
return jit and jit.version or rawget(_G, "_VERSION")
end)()
mineunit_version_str = "Mineunit v" .. mineunit_version .. " (" .. luaversion .. ")"

mineunit_conf_defaults = {}
mineunit_conf_override = {}

Expand Down Expand Up @@ -216,8 +223,11 @@ do -- Parse cli args
local i = 1
while arg[i] do
local v = arg[i]
if v == "-V" or v == "--version" or v == "-h" or v == "--help" then
print(({([[Mineunit v0.10.1-better-than-ever
if v == "-V" or v == "--version" then
print(mineunit_version_str)
return
elseif v == "-h" or v == "--help" then
print(({(mineunit_version_str..[[

Usage:
mineunit [-c|--coverage] [-v|--verbose] [-q|--quiet] [-x|--exclude <pattern>] \
Expand All @@ -242,8 +252,11 @@ do -- Parse cli args
Download core engine libraries for tag.
This is simple wrapper around `git clone`.

-v|--verbose Be verbose, prints more useless crap to console.
-v|--verbose Be more verbose by printing more useless crap to console.
Can be repeated up to six times for even more annoying output.
-q|--quiet Be quiet, most of time keeps your console fairly clean.
Always disables regular Lua print which can make output
somewhat less annoying when combined with --verbose output.

Resources:
Luarocks package: https://luarocks.org/modules/S-S-X/mineunit
Expand All @@ -266,10 +279,14 @@ do -- Parse cli args
elseif v == "-r" or v == "--report" then
args.report = true
elseif v == "-v" or v == "--verbose" then
if args.verbose then
mineunit_conf_override.verbose = mineunit_conf_override.verbose
and mineunit_conf_override.verbose + 1 or 1
end
args.verbose = true
elseif v == "-q" or v == "--quiet" then
mineunit_conf_override.print = false
mineunit_conf_override.verbose = 1
mineunit_conf_override.verbose = mineunit_conf_override.verbose or 1
args.quiet = true
elseif v == "-x" or v == "--exclude" then
i = i + 1
Expand Down
5 changes: 0 additions & 5 deletions common/fs.lua

This file was deleted.

2 changes: 1 addition & 1 deletion core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mineunit("common/misc_helpers")
mineunit("game/privileges")
mineunit("game/features")
mineunit("common/serialize")
mineunit("common/fs")
mineunit("fs")

assert(minetest.registered_nodes["air"])
assert(minetest.registered_nodes["ignore"])
Expand Down
17 changes: 17 additions & 0 deletions fs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local pl = {
dir = require 'pl.dir',
path = require 'pl.path',
}

core.mkdir = function()
-- no-op
-- TODO: create directory and implement io.* functions
end

core.get_dir_list = function(path, list_dirs)
local results = {}
for _,name in ipairs(list_dirs and pl.dir.getdirectories(path) or pl.dir.getfiles(path)) do
table.insert(results, pl.path.basename(name))
end
return results
end
Loading