diff options
author | Rebecca Turner <rbt@sent.as> | 2023-10-10 13:23:29 -0700 |
---|---|---|
committer | Rebecca Turner <rbt@sent.as> | 2023-10-10 13:23:29 -0700 |
commit | 00ad081732cfd1dc7e340597f2000de751960471 (patch) | |
tree | c2df4380a658d2e92b7eaf1b42f8ac8470f12cf7 | |
parent | adde1d0a5001de44c8ee331f671668d509e23ce2 (diff) | |
download | lua-language-server-00ad081732cfd1dc7e340597f2000de751960471.zip |
Add `--check_out_path` CLI argument
This allows customizing where the diagnostic JSON file is saved.
-rw-r--r-- | script/cli/check.lua | 5 | ||||
-rw-r--r-- | script/global.d.lua | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/script/cli/check.lua b/script/cli/check.lua index 323ea74b..4295fa06 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 aedcc38c..b44d6371 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' |