Skip to content

Commit 73c405b

Browse files
committed
ci
1 parent 1eab1e0 commit 73c405b

File tree

5 files changed

+41
-13
lines changed

5 files changed

+41
-13
lines changed

main.lua

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,41 @@ local fs = require 'bee.filesystem'
22
local util = require 'utility'
33
local version = require 'version'
44

5+
local function getValue(value)
6+
if value == 'true' or value == nil then
7+
value = true
8+
elseif value == 'false' then
9+
value = false
10+
elseif tonumber(value) then
11+
value = tonumber(value)
12+
elseif value:sub(1, 1) == '"' and value:sub(-1, -1) == '"' then
13+
value = value:sub(2, -2)
14+
end
15+
return value
16+
end
17+
518
local function loadArgs()
19+
local lastKey
620
for _, v in ipairs(arg) do
721
---@type string
822
local key, tail = v:match '^%-%-([%w_]+)(.*)$'
9-
if not key then
10-
goto CONTINUE
23+
local value
24+
if key then
25+
value = tail:match '=(.+)'
26+
lastKey = nil
27+
if not value then
28+
lastKey = key
29+
end
30+
else
31+
if lastKey then
32+
key = lastKey
33+
value = v
34+
lastKey = nil
35+
end
1136
end
12-
local value = tail:match '=(.+)'
13-
if value == 'true' or value == nil then
14-
value = true
15-
elseif value == 'false' then
16-
value = false
17-
elseif tonumber(value) then
18-
value = tonumber(value)
19-
elseif value:sub(1, 1) == '"' and value:sub(-1, -1) == '"' then
20-
value = value:sub(2, -2)
37+
if key then
38+
_G[key:upper()] = getValue(value)
2139
end
22-
_G[key:upper()] = value
23-
::CONTINUE::
2440
end
2541
end
2642

make/bootstrap.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ while arg[i] do
1010
exec = true
1111
elseif not main and arg[i]:sub(1, 1) ~= '-' then
1212
main = i
13+
elseif arg[i]:sub(1, 2) == '--' then
14+
break
1315
end
1416
i = i + 1
1517
end

script/ci/check.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print(CHECK)

script/ci/init.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ if _G['VERSION'] then
22
require 'ci.version'
33
os.exit(0, true)
44
end
5+
6+
if _G['CHECK'] then
7+
require 'ci.check'
8+
os.exit(0, true)
9+
end

script/global.d.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ RPCLOG = false
3939
--the current version is `formatting`
4040
---@type boolean
4141
PREVIEW = false
42+
43+
--check path
44+
---@type string
45+
CHECK = ''

0 commit comments

Comments
 (0)