diff options
| author | ruki <[email protected]> | 2022-11-13 08:32:32 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-13 08:32:32 +0800 |
| commit | a9f83eadd54b817fea8e5ff523b8b66b351f5133 (patch) | |
| tree | eb1948389e71acd8fda8a3d5396681f674dbc831 /xmake/plugins/format | |
| parent | b1de5d120ee35548083e060a60f836c0d3819a31 (diff) | |
Update main.lua
Diffstat (limited to 'xmake/plugins/format')
| -rw-r--r-- | xmake/plugins/format/main.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/plugins/format/main.lua b/xmake/plugins/format/main.lua index 162f1fb31..2a63a93a8 100644 --- a/xmake/plugins/format/main.lua +++ b/xmake/plugins/format/main.lua @@ -53,13 +53,12 @@ function main() end assert(clang_format, "clang-format not found!") - local argv = {} - -- create style file + local argv = {} + local projectdir = project.directory() if option.get("create-style") then table.insert(argv, "--style=" .. option.get("create-style")) table.insert(argv, "--dump-config") - local projectdir = project.directory() os.execv(clang_format.program, argv, {stdout = path.join(projectdir, ".clang-format"), curdir = projectdir}) return end @@ -71,13 +70,14 @@ function main() -- 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()}) + os.vrunv(clang_format.program, argv, {curdir = projectdir}) cprint("${color.success}formatting complete") os.setenvs(oldenvs) |
