Clean up coded formatting and add stronger typechecks
This commit is contained in:
+4
-4
@@ -5,8 +5,8 @@ local fs = require("@lune/fs")
|
|||||||
local types = require("./types")
|
local types = require("./types")
|
||||||
|
|
||||||
export type CLI = {
|
export type CLI = {
|
||||||
parseArgs: () -> types.opts,
|
parseArgs: () -> types.opts,
|
||||||
printUsage: () -> (),
|
printUsage: () -> (),
|
||||||
checkOutputFile: (outputFile: string?) -> ()
|
checkOutputFile: (outputFile: string?) -> ()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,8 +14,8 @@ local cli = {} :: CLI
|
|||||||
|
|
||||||
-- parses command line arguments into options
|
-- parses command line arguments into options
|
||||||
function cli.parseArgs(): types.opts
|
function cli.parseArgs(): types.opts
|
||||||
local args = process.args
|
local args: {string} = process.args
|
||||||
local opts = {
|
local opts: types.opts = {
|
||||||
outputFile = nil,
|
outputFile = nil,
|
||||||
directoryMode = false,
|
directoryMode = false,
|
||||||
directoryPath = nil,
|
directoryPath = nil,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function compressionModule.zlibDecompress(contents: string, recursive: boolean?)
|
|||||||
assert(typeof(contents) == "string", "Expected contents to be of type 'string'")
|
assert(typeof(contents) == "string", "Expected contents to be of type 'string'")
|
||||||
if recursive == nil then recursive = false end
|
if recursive == nil then recursive = false end
|
||||||
assert(typeof(recursive) == "boolean", "Expected recursive to be of type 'boolean'")
|
assert(typeof(recursive) == "boolean", "Expected recursive to be of type 'boolean'")
|
||||||
local success, decompressed = pcall(function() return serde.decompress("zlib", contents) end)
|
local success, decompressed: string = pcall(function() return serde.decompress("zlib", contents) end)
|
||||||
if not success then
|
if not success then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user