summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-29 00:36:05 +0800
committerruki <[email protected]>2021-10-29 00:36:05 +0800
commit2505c46acf19f66d92765854f0853d251be30506 (patch)
tree3c49a9d736da1adb67678def4e3bee1e8b491dd4 /xmake/modules/private/utils/batchcmds.lua
parentefae56f4b2f474611ecfc91efb0c79720389a97d (diff)
improve cmakelists
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 34dd5d583..bb5204072 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -117,6 +117,14 @@ function _runcmd_mkdir(cmd, opt)
end
end
+-- run command: os.cd
+function _runcmd_cd(cmd, opt)
+ local dir = cmd.dir
+ if not opt.dryrun then
+ os.cd(dir)
+ end
+end
+
-- run command: os.rm
function _runcmd_rm(cmd, opt)
local filepath = cmd.filepath
@@ -158,6 +166,7 @@ function _runcmd(cmd, opt)
vrunv = _runcmd_vrunv,
execv = _runcmd_execv,
mkdir = _runcmd_mkdir,
+ cd = _runcmd_cd,
rm = _runcmd_rm,
cp = _runcmd_cp,
mv = _runcmd_mv,
@@ -268,6 +277,11 @@ function batchcmds:ln(srcpath, dstpath, opt)
table.insert(self:cmds(), {kind = "ln", srcpath = srcpath, dstpath = dstpath, opt = opt})
end
+-- add command: os.cd
+function batchcmds:cd(dir, opt)
+ table.insert(self:cmds(), {kind = "cd", dir = dir, opt = opt})
+end
+
-- add command: show
function batchcmds:show(format, ...)
local showtext = string.format(format, ...)