mirror of
https://github.com/leafo/moonscript.git
synced 2024-10-05 05:34:19 +00:00
Merge pull request #432 from natnat-mc/patch-1
Fix `-` flag for `moonc`
This commit is contained in:
commit
1a68425a28
9
bin/moonc
Executable file → Normal file
9
bin/moonc
Executable file → Normal file
@ -23,13 +23,18 @@ parser:mutex(
|
|||||||
parser:flag("-",
|
parser:flag("-",
|
||||||
"Read from standard in, print to standard out (Must be only argument)")
|
"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
|
if not read_stdin then
|
||||||
parser:argument("file/directory"):args("+")
|
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
|
end
|
||||||
|
|
||||||
local opts = parser:parse()
|
local opts = read_stdin and {} or parser:parse()
|
||||||
|
|
||||||
if opts.version then
|
if opts.version then
|
||||||
local v = require "moonscript.version"
|
local v = require "moonscript.version"
|
||||||
|
Loading…
Reference in New Issue
Block a user