summaryrefslogtreecommitdiff
path: root/xmake/plugins/service/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-05 00:42:04 +0800
committerruki <[email protected]>2022-04-05 00:42:04 +0800
commitea532e409179feadb227148a67fd4b22c889cea6 (patch)
tree91b91e5307f98ea9c8e79e025e47c11ce2d06c15 /xmake/plugins/service/main.lua
parent4679c558ab35d246c177ed77028f776ecc8373d2 (diff)
add remote build server stub
Diffstat (limited to 'xmake/plugins/service/main.lua')
-rw-r--r--xmake/plugins/service/main.lua33
1 files changed, 31 insertions, 2 deletions
diff --git a/xmake/plugins/service/main.lua b/xmake/plugins/service/main.lua
index 8249154c2..8e1ba8c4b 100644
--- a/xmake/plugins/service/main.lua
+++ b/xmake/plugins/service/main.lua
@@ -20,9 +20,38 @@
-- imports
import("core.base.option")
+import("service")
+
+function _start_service(opt)
+ opt = opt or {}
+ if opt.daemon then
+ os.execv(os.programfile(), {"lua", path.join(os.scriptdir(), "service.lua")}, {detach = true})
+ else
+ service()
+ end
+end
+
+function _restart_service()
+end
+
+function _show_service_logs()
+end
+
+function _show_service_status()
+end
--- main
function main()
- cprint("${color.warning}Experimental, still in development!")
+ cprint("${color.warning}It's experimental feature, still in development!")
+ if option.get("start") then
+ _start_service({daemon = true})
+ elseif option.get("restart") then
+ _restart_service()
+ elseif option.get("logs") then
+ _show_service_logs()
+ elseif option.get("status") then
+ _show_service_status()
+ else
+ _start_service()
+ end
end