summaryrefslogtreecommitdiff
path: root/xmake/plugins/format
diff options
context:
space:
mode:
authorA2va <[email protected]>2022-11-12 14:50:19 +0100
committerA2va <[email protected]>2022-11-12 14:50:19 +0100
commitb1de5d120ee35548083e060a60f836c0d3819a31 (patch)
tree7a610564c85e0c057f752704938d5d84fa3c6c08 /xmake/plugins/format
parent54ed917dee71173aa9400032419d7506a050ba3b (diff)
Apply modifications from code review
Diffstat (limited to 'xmake/plugins/format')
-rw-r--r--xmake/plugins/format/main.lua6
-rw-r--r--xmake/plugins/format/xmake.lua2
2 files changed, 4 insertions, 4 deletions
diff --git a/xmake/plugins/format/main.lua b/xmake/plugins/format/main.lua
index 79561daba..162f1fb31 100644
--- a/xmake/plugins/format/main.lua
+++ b/xmake/plugins/format/main.lua
@@ -59,8 +59,8 @@ function main()
if option.get("create-style") then
table.insert(argv, "--style=" .. option.get("create-style"))
table.insert(argv, "--dump-config")
- local outdata, errdata = os.iorunv(clang_format.program, argv)
- io.writefile(".clang-format", outdata, {curdir = project.directory()})
+ local projectdir = project.directory()
+ os.execv(clang_format.program, argv, {stdout = path.join(projectdir, ".clang-format"), curdir = projectdir})
return
end
@@ -70,7 +70,7 @@ function main()
end
-- inplace flag
- table.insert(argv,"-i")
+ table.insert(argv, "-i")
-- set file to format
if option.get("file") then
table.insert(argv, option.get("file"))
diff --git a/xmake/plugins/format/xmake.lua b/xmake/plugins/format/xmake.lua
index d02db5fc4..5cb1c913e 100644
--- a/xmake/plugins/format/xmake.lua
+++ b/xmake/plugins/format/xmake.lua
@@ -37,7 +37,7 @@ task("format")
options = {
{'s', "style", "kv", nil, "Set the path of .clang-format file, a coding style"..
"(LLVM, Google, Chromium, Mozilla, WebKit) or key value string" },
- {nil, "create-style", "kv", nil, "Create a .clang-format file from a coding style" },
+ {nil, "create-style", "kv", nil, "Create a .clang-format file from a coding style" },
{'f', "file", "v", "*.cpp *.h *.hpp", "Set file path or glob pattern"}
}
}