summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-02 12:51:30 +0800
committerruki <[email protected]>2017-05-02 12:51:30 +0800
commite269996c0e8e09596622b378874d06e931f1f109 (patch)
treea5a740ff4838c404bd25c62647669db94880db6b /xmake/plugins/lua/xmake.lua
parent690218ac54b965536a740782f8c93bec75224339 (diff)
add sandbox interactive
Diffstat (limited to 'xmake/plugins/lua/xmake.lua')
-rw-r--r--xmake/plugins/lua/xmake.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index 917d66119..1c6b2bf27 100644
--- a/xmake/plugins/lua/xmake.lua
+++ b/xmake/plugins/lua/xmake.lua
@@ -33,6 +33,7 @@ task("lua")
-- imports
import("core.base.option")
+ import("core.sandbox.sandbox")
-- list all scripts?
if option.get("list") then
@@ -46,15 +47,17 @@ task("lua")
-- get script name
local name = option.get("script")
- if not name then
- raise("no script!")
- end
+ if name then
- -- import script
- if os.isfile(name) then
- import(path.basename(name), {rootdir = path.directory(name)}).main(unpack(option.get("arguments") or {}))
+ -- import and run script
+ if os.isfile(name) then
+ import(path.basename(name), {rootdir = path.directory(name)}).main(unpack(option.get("arguments") or {}))
+ else
+ import("scripts." .. name).main(unpack(option.get("arguments") or {}))
+ end
else
- import("scripts." .. name).main(unpack(option.get("arguments") or {}))
+ -- enter interactive mode
+ sandbox.interactive()
end
end)