Skip to content

Commit 1a68425

Browse files
authored
Merge pull request #432 from natnat-mc/patch-1
Fix `-` flag for `moonc`
2 parents 87fa9e8 + b972b0d commit 1a68425

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bin/moonc

100755100644
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@ parser:mutex(
2323
parser:flag("-",
2424
"Read from standard in, print to standard out (Must be only argument)")
2525

26-
local read_stdin = arg[1] == "--" -- luacheck: ignore 113
26+
local read_stdin = arg[1] == "-" -- luacheck: ignore 113
2727

2828
if not read_stdin then
2929
parser:argument("file/directory"):args("+")
30+
else
31+
if arg[2] ~= nil then
32+
io.stderr:write("- must be the only argument\n")
33+
os.exit(1)
34+
end
3035
end
3136

32-
local opts = parser:parse()
37+
local opts = read_stdin and {} or parser:parse()
3338

3439
if opts.version then
3540
local v = require "moonscript.version"

0 commit comments

Comments
 (0)