Merge pull request #432 from natnat-mc/patch-1

Fix `-` flag for `moonc`
This commit is contained in:
leaf 2022-11-04 12:52:38 -07:00 committed by GitHub
commit 1a68425a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

9
bin/moonc Executable file → Normal file
View File

@ -23,13 +23,18 @@ parser:mutex(
parser:flag("-",
"Read from standard in, print to standard out (Must be only argument)")
local read_stdin = arg[1] == "--" -- luacheck: ignore 113
local read_stdin = arg[1] == "-" -- luacheck: ignore 113
if not read_stdin then
parser:argument("file/directory"):args("+")
else
if arg[2] ~= nil then
io.stderr:write("- must be the only argument\n")
os.exit(1)
end
end
local opts = parser:parse()
local opts = read_stdin and {} or parser:parse()
if opts.version then
local v = require "moonscript.version"