summaryrefslogtreecommitdiff
path: root/xmake/plugins/service/main.lua
diff options
context:
space:
mode:
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