keep help on stdout unless error

This commit is contained in:
leaf corcoran 2013-12-26 22:47:11 -08:00
parent 18a3723f00
commit 5461bd179b

View File

@ -40,12 +40,16 @@ if opts.v then
end end
function print_help(err) function print_help(err)
local help_msg = help:format(arg[0])
if err then if err then
io.stderr:write("Error: ".. err .. "\n") io.stderr:write("Error: ".. err .. "\n")
io.stderr:write(help_msg .. "\n")
os.exit(1)
else
print(help_msg)
os.exit(0)
end end
io.stderr:write(help:format(arg[0]) .. "\n")
os.exit(1)
end end
function mkdir(path) function mkdir(path)