summaryrefslogtreecommitdiff
path: root/xmake/plugins/format/xmake.lua
diff options
context:
space:
mode:
authorjj683 <[email protected]>2024-11-30 12:49:55 +0100
committerjj683 <[email protected]>2024-11-30 12:49:55 +0100
commit644009926af1ad90bfcc47cf8bd625813c19b9c1 (patch)
tree54f94151bb65e3b524c6ee815750d467e789f1ad /xmake/plugins/format/xmake.lua
parent2f1213a70b2ea1be2097c7f2bd7b4fc85a861b80 (diff)
Add Werror and dry-run flags for clang-format
Diffstat (limited to 'xmake/plugins/format/xmake.lua')
-rw-r--r--xmake/plugins/format/xmake.lua39
1 files changed, 21 insertions, 18 deletions
diff --git a/xmake/plugins/format/xmake.lua b/xmake/plugins/format/xmake.lua
index 4d1b2a6f8..c8cfb9392 100644
--- a/xmake/plugins/format/xmake.lua
+++ b/xmake/plugins/format/xmake.lua
@@ -25,24 +25,27 @@ task("format")
usage = "xmake format [options] [arguments]",
description = "Format the current project.",
options = {
- {'s', "style", "kv", nil, "Set the path of .clang-format file, a coding style",
- values = {"LLVM", "Google", "Chromium", "Mozilla", "WebKit"}},
- {nil, "create", "k", nil, "Create a .clang-format file from a coding style"},
- {'a', "all", "k", nil, "Format all targets."},
- {'g', "group", "kv", nil, "Format all targets of the given group. It support path pattern matching.",
- "e.g.",
- " xmake format -g test",
- " xmake format -g test_*",
- " xmake format --group=benchmark/*"},
- {'f', "files", "kv", nil, "Build the given source files.",
- "e.g.",
- " - xmake format --files=src/main.c",
- " - xmake format --files='src/*.c' [target]",
- " - xmake format --files='src/**.c|excluded_file.c",
- " - xmake format --files='src/main.c" .. path.envsep() .. "src/test.c'" },
- {},
- {nil, "target", "v", nil, "The target name. It will format all default targets if this parameter is not specified."
- , values = function (complete, opt) return import("private.utils.complete_helper.targets")(complete, opt) end }
+ {'s', "style", "kv", nil, "Set the path of .clang-format file, a coding style",
+ values = {"LLVM", "Google", "Chromium", "Mozilla", "WebKit"}},
+ {nil, "create", "k", nil, "Create a .clang-format file from a coding style"},
+ {'n', "dry-run", "k", nil, "Do not make any changes, just show the files that would be formatted."},
+ {'e', "error", "k", nil, "If set, changes formatting warnings to errors."},
+ {'v', "verbose", "k", nil, "Print verbose information."},
+ {'a', "all", "k", nil, "Format all targets."},
+ {'g', "group", "kv", nil, "Format all targets of the given group. It support path pattern matching.",
+ "e.g.",
+ " xmake format -g test",
+ " xmake format -g test_*",
+ " xmake format --group=benchmark/*"},
+ {'f', "files", "kv", nil, "Build the given source files.",
+ "e.g.",
+ " - xmake format --files=src/main.c",
+ " - xmake format --files='src/*.c' [target]",
+ " - xmake format --files='src/**.c|excluded_file.c",
+ " - xmake format --files='src/main.c" .. path.envsep() .. "src/test.c'" },
+ {},
+ {nil, "target", "v", nil, "The target name. It will format all default targets if this parameter is not specified."
+ , values = function (complete, opt) return import("private.utils.complete_helper.targets")(complete, opt) end }
}
}