summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-10-12 15:13:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-10-12 15:13:55 +0800
commit56113f40a21d2d5bbc2cbbfa6a2d5d546069d5c8 (patch)
tree753c3190387f55ebb23b628403b3667284458a75
parent336eaae1db339f29b177aaa5fd05c46e4bde7368 (diff)
downloadlua-language-server-56113f40a21d2d5bbc2cbbfa6a2d5d546069d5c8.zip
reslove #194 --version
-rw-r--r--main.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index 40703350..edbdae8c 100644
--- a/main.lua
+++ b/main.lua
@@ -5,11 +5,12 @@ local version = require 'version'
local function loadArgs()
for _, v in ipairs(arg) do
---@type string
- local key, value = v:match '^%-%-([%w_]+)%=(.+)'
+ local key, tail = v:match '^%-%-([%w_]+)(.*)$'
if not key then
goto CONTINUE
end
- if value == 'true' then
+ local value = tail:match '=(.+)'
+ if value == 'true' or value == nil then
value = true
elseif value == 'false' then
value = false
@@ -32,6 +33,11 @@ ROOT = fs.path(util.expandPath(rootPath))
LOGPATH = LOGPATH and util.expandPath(LOGPATH) or (ROOT:string() .. '/log')
METAPATH = METAPATH and util.expandPath(METAPATH) or (ROOT:string() .. '/meta')
+if _G['VERSION'] then
+ print(version.getVersion())
+ return
+end
+
---@diagnostic disable-next-line: deprecated
debug.setcstacklimit(200)
--collectgarbage('generational', 5, 25)