diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-01 16:50:37 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-01 16:50:37 +0800 |
commit | 73c405b176ef9aa8468c6279fab883943def7ade (patch) | |
tree | b8e4c26f753be9bd9d738ad1a6e8f72541a111c6 | |
parent | 1eab1e0ed18697304619b0e1ec15064a155aa772 (diff) | |
download | lua-language-server-73c405b176ef9aa8468c6279fab883943def7ade.zip |
ci
-rw-r--r-- | main.lua | 42 | ||||
-rw-r--r-- | make/bootstrap.lua | 2 | ||||
-rw-r--r-- | script/ci/check.lua | 1 | ||||
-rw-r--r-- | script/ci/init.lua | 5 | ||||
-rw-r--r-- | script/global.d.lua | 4 |
5 files changed, 41 insertions, 13 deletions
@@ -2,25 +2,41 @@ local fs = require 'bee.filesystem' local util = require 'utility' local version = require 'version' +local function getValue(value) + if value == 'true' or value == nil then + value = true + elseif value == 'false' then + value = false + elseif tonumber(value) then + value = tonumber(value) + elseif value:sub(1, 1) == '"' and value:sub(-1, -1) == '"' then + value = value:sub(2, -2) + end + return value +end + local function loadArgs() + local lastKey for _, v in ipairs(arg) do ---@type string local key, tail = v:match '^%-%-([%w_]+)(.*)$' - if not key then - goto CONTINUE + local value + if key then + value = tail:match '=(.+)' + lastKey = nil + if not value then + lastKey = key + end + else + if lastKey then + key = lastKey + value = v + lastKey = nil + end end - local value = tail:match '=(.+)' - if value == 'true' or value == nil then - value = true - elseif value == 'false' then - value = false - elseif tonumber(value) then - value = tonumber(value) - elseif value:sub(1, 1) == '"' and value:sub(-1, -1) == '"' then - value = value:sub(2, -2) + if key then + _G[key:upper()] = getValue(value) end - _G[key:upper()] = value - ::CONTINUE:: end end diff --git a/make/bootstrap.lua b/make/bootstrap.lua index c820a869..6c27cf95 100644 --- a/make/bootstrap.lua +++ b/make/bootstrap.lua @@ -10,6 +10,8 @@ while arg[i] do exec = true
elseif not main and arg[i]:sub(1, 1) ~= '-' then
main = i
+ elseif arg[i]:sub(1, 2) == '--' then
+ break
end
i = i + 1
end
diff --git a/script/ci/check.lua b/script/ci/check.lua new file mode 100644 index 00000000..90834234 --- /dev/null +++ b/script/ci/check.lua @@ -0,0 +1 @@ +print(CHECK) diff --git a/script/ci/init.lua b/script/ci/init.lua index 8d2a4e15..8b142291 100644 --- a/script/ci/init.lua +++ b/script/ci/init.lua @@ -2,3 +2,8 @@ if _G['VERSION'] then require 'ci.version' os.exit(0, true) end + +if _G['CHECK'] then + require 'ci.check' + os.exit(0, true) +end diff --git a/script/global.d.lua b/script/global.d.lua index ad4fb364..2bc32c29 100644 --- a/script/global.d.lua +++ b/script/global.d.lua @@ -39,3 +39,7 @@ RPCLOG = false --the current version is `formatting` ---@type boolean PREVIEW = false + +--check path +---@type string +CHECK = '' |