summaryrefslogtreecommitdiffstatshomepage
path: root/tools/codeformat.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/codeformat.py')
-rwxr-xr-xtools/codeformat.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/codeformat.py b/tools/codeformat.py
index 2fe72ef33d..5aef4ccfbf 100755
--- a/tools/codeformat.py
+++ b/tools/codeformat.py
@@ -138,6 +138,7 @@ def main():
cmd_parser = argparse.ArgumentParser(description="Auto-format C and Python files.")
cmd_parser.add_argument("-c", action="store_true", help="Format C code only")
cmd_parser.add_argument("-p", action="store_true", help="Format Python code only")
+ cmd_parser.add_argument("-v", action="store_true", help="Enable verbose output")
cmd_parser.add_argument("files", nargs="*", help="Run on specific globs")
args = cmd_parser.parse_args()
@@ -168,13 +169,21 @@ def main():
# Format C files with uncrustify.
if format_c:
- batch(["uncrustify", "-q", "-c", UNCRUSTIFY_CFG, "-lC", "--no-backup"], lang_files(C_EXTS))
+ command = ["uncrustify", "-c", UNCRUSTIFY_CFG, "-lC", "--no-backup"]
+ if not args.v:
+ command.append("-q")
+ batch(command, lang_files(C_EXTS))
for file in lang_files(C_EXTS):
fixup_c(file)
# Format Python files with black.
if format_py:
- batch(["black", "-q", "--fast", "--line-length=99"], lang_files(PY_EXTS))
+ command = ["black", "--fast", "--line-length=99"]
+ if args.v:
+ command.append("-v")
+ else:
+ command.append("-q")
+ batch(command, lang_files(PY_EXTS))
if __name__ == "__main__":