mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
restore -o
This commit is contained in:
parent
13da7286f8
commit
fe2984f85d
17
bin/moonc
17
bin/moonc
@ -118,7 +118,9 @@ local function get_files(fname, files)
|
||||
return files
|
||||
end
|
||||
|
||||
if opts.h then print_help() end
|
||||
if opts.h then
|
||||
print_help()
|
||||
end
|
||||
|
||||
if read_stdin then
|
||||
local parse = require "moonscript.parse"
|
||||
@ -156,6 +158,10 @@ files = remove_dups(files, function(f)
|
||||
return f[2]
|
||||
end)
|
||||
|
||||
if opts.o and #files > 1 then
|
||||
print_help("-o can not be used with multiple input files")
|
||||
end
|
||||
|
||||
local function get_sleep_func()
|
||||
local sleep
|
||||
if not pcall(function()
|
||||
@ -271,6 +277,11 @@ if opts.w then
|
||||
|
||||
for fname in protected do
|
||||
local target = path_to_target(fname, opts.t)
|
||||
|
||||
if opts.o then
|
||||
target = opts.o
|
||||
end
|
||||
|
||||
local success, err = compile_and_write(fname, target)
|
||||
if not success then
|
||||
io.stderr:write(table.concat({
|
||||
@ -299,6 +310,10 @@ elseif opts.l then
|
||||
else
|
||||
for _, tuple in ipairs(files) do
|
||||
local fname, target = unpack(tuple)
|
||||
if opts.o then
|
||||
target = opts.o
|
||||
end
|
||||
|
||||
local success, err = compile_and_write(fname, target)
|
||||
if not success then
|
||||
io.stderr:write(fname .. "\t" .. err .. "\n")
|
||||
|
Loading…
Reference in New Issue
Block a user