From 00ad081732cfd1dc7e340597f2000de751960471 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Tue, 10 Oct 2023 13:23:29 -0700 Subject: [PATCH] Add `--check_out_path` CLI argument This allows customizing where the diagnostic JSON file is saved. --- script/cli/check.lua | 5 ++++- script/global.d.lua | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/script/cli/check.lua b/script/cli/check.lua index 323ea74bd..4295fa06b 100644 --- a/script/cli/check.lua +++ b/script/cli/check.lua @@ -99,7 +99,10 @@ end if count == 0 then print(lang.script('CLI_CHECK_SUCCESS')) else - local outpath = LOGPATH .. '/check.json' + local outpath = CHECK_OUT_PATH + if outpath == nil then + outpath = LOGPATH .. '/check.json' + end util.saveFile(outpath, jsonb.beautify(results)) print(lang.script('CLI_CHECK_RESULTS', count, outpath)) diff --git a/script/global.d.lua b/script/global.d.lua index aedcc38c6..b44d63712 100644 --- a/script/global.d.lua +++ b/script/global.d.lua @@ -55,6 +55,12 @@ DOC = '' ---@type string | '"Error"' | '"Warning"' | '"Information"' | '"Hint"' CHECKLEVEL = 'Warning' +--Where to write the check results (JSON). +-- +--If nil, use `LOGPATH/check.json`. +---@type string|nil +CHECK_OUT_PATH = '' + ---@type 'trace' | 'debug' | 'info' | 'warn' | 'error' LOGLEVEL = 'warn'