summaryrefslogtreecommitdiff
path: root/xmake/plugins/format/main.lua
diff options
context:
space:
mode:
authorA2va <[email protected]>2022-11-11 18:54:32 +0100
committerA2va <[email protected]>2022-11-11 18:54:32 +0100
commitd3b7498679fd2c1234c118a056a84f8aa3fa04d3 (patch)
treeb9c4c88787e629c541d35ef3b6990c48f7cdbe56 /xmake/plugins/format/main.lua
parent808290756e24ce7ee70d5897477c5b20bd751981 (diff)
Invoke clang-format
Diffstat (limited to 'xmake/plugins/format/main.lua')
-rw-r--r--xmake/plugins/format/main.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/plugins/format/main.lua b/xmake/plugins/format/main.lua
index a3973fee9..79561daba 100644
--- a/xmake/plugins/format/main.lua
+++ b/xmake/plugins/format/main.lua
@@ -69,5 +69,16 @@ function main()
table.insert(argv, "--style=" .. option.get("style"))
end
+ -- inplace flag
+ table.insert(argv,"-i")
+ -- set file to format
+ if option.get("file") then
+ table.insert(argv, option.get("file"))
+ end
+
+ -- format files
+ os.vrunv(clang_format.program, argv, {curdir = project.directory()})
+ cprint("${color.success}formatting complete")
+
os.setenvs(oldenvs)
end