From f7105a747ea01fe7a050082f715b408dd7853d21 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 21 Apr 2023 21:41:56 +0200 Subject: [PATCH] Update uncrustify usage in README --- AfRApay.MateCard/README.md | 2 +- scripts/uncrustify.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 scripts/uncrustify.sh diff --git a/AfRApay.MateCard/README.md b/AfRApay.MateCard/README.md index d851ca5..b9cec47 100644 --- a/AfRApay.MateCard/README.md +++ b/AfRApay.MateCard/README.md @@ -7,4 +7,4 @@ This project uses PlatformIO. Quick setup guide: - To compile, run `pio run` - To compile and upload, run `pio run -t upload` - To run clang-tidy, run `pio check`. -- Please run `uncrustify --no-backup -c .uncrustify.cfg src/*.cpp include/*.h` before commiting. To install it as a pre-commit hook, run `ln -s ../../hooks/pre-commit.hook ../.git/hooks/pre-commit` in this directory. +- Please run `./scripts/uncrustify.sh` before commiting. To install it as a pre-commit hook, run `ln -s ../../hooks/pre-commit.hook ../.git/hooks/pre-commit` in this directory. diff --git a/scripts/uncrustify.sh b/scripts/uncrustify.sh new file mode 100644 index 0000000..41b1cf1 --- /dev/null +++ b/scripts/uncrustify.sh @@ -0,0 +1,6 @@ +#!/bin/bash +script=$(realpath "$0") +scripts_root=$(dirname "$script") +project_root=$(dirname "$scripts_root") +tgt="$project_root/AfRApay.MateCard" +find "$tgt" -type f -path "$tgt/src/*.cpp" -or -path "$tgt/include/*.h" | uncrustify --no-backup -c "$tgt/.uncrustify.cfg" -F -