summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorÂngelo Andrade Cirino <[email protected]>2022-01-10 10:23:17 -0300
committerÂngelo Andrade Cirino <[email protected]>2022-01-10 10:23:17 -0300
commited0c0c5e0249aa966ea7061b30710abdd0b09d87 (patch)
tree2a51c869a3aea1a093ed569e749bdf0465634a6c /xmake/modules/private/utils/batchcmds.lua
parent885d00da8caf74aeed758d030b9a1b50d9078e1f (diff)
parent2431dd7e6142ff98b55741cfd4de4d2e69f4f8b5 (diff)
Merged from upstream/master
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua22
1 files changed, 18 insertions, 4 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 371735321..bb5204072 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -28,7 +28,7 @@ import("core.theme.theme")
import("core.tool.linker")
import("core.tool.compiler")
import("core.language.language")
-import("private.utils.progress", {alias = "progress_utils"})
+import("utils.progress", {alias = "progress_utils"})
-- define module
local batchcmds = batchcmds or object { _init = {"_TARGET", "_CMDS", "_DEPS", "_tip"}}
@@ -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
@@ -128,21 +136,21 @@ end
-- run command: os.cp
function _runcmd_cp(cmd, opt)
if not opt.dryrun then
- os.cp(opt.srcpath, opt.dstpath, opt.opt)
+ os.cp(cmd.srcpath, cmd.dstpath, opt.opt)
end
end
-- run command: os.mv
function _runcmd_mv(cmd, opt)
if not opt.dryrun then
- os.mv(opt.srcpath, opt.dstpath, opt.opt)
+ os.mv(cmd.srcpath, cmd.dstpath, opt.opt)
end
end
-- run command: os.ln
function _runcmd_ln(cmd, opt)
if not opt.dryrun then
- os.ln(opt.srcpath, opt.dstpath, opt.opt)
+ os.ln(cmd.srcpath, cmd.dstpath, opt.opt)
end
end
@@ -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, ...)