From e4a8138b9033d5e9483186004fdefe70963abe61 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Sun, 29 Jan 2017 20:32:29 +0100 Subject: [PATCH] Add format_sources for use with KDevelop's reformat-sources action. Note: this depends on clang-format and moreutils' sponge --- format_sources | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 format_sources diff --git a/format_sources b/format_sources new file mode 100644 index 0000000..597d563 --- /dev/null +++ b/format_sources @@ -0,0 +1,7 @@ +# clang-format's assume-filename seems to be broken +# we must not specify the path to $TMPFILE directly, as clang-format would then +# look in that folder for the config file. Instead, we want it to use the current +# CWD which can be achieved by piping in the file. But then we need to overwrite +# the original file again, which can be done with sponge easily +src/*.cpp src/*.h tests/*.h tests/*.cpp : clang-format < $TMPFILE | sponge $TMPFILE + -- 2.7.4