Skip to content

Commit 6b47f79

Browse files
committed
inital support for switching between clang-format files.
1 parent 13c5b5c commit 6b47f79

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ vsprojects/packages
3333
/memcard1.mcd
3434
/memcard2.mcd
3535

36+
src/.clang-format
File renamed without changes.

tools/code-format/format.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
#!/bin/sh
2+
set -e
3+
4+
if [ $# -gt 0 ]; then
5+
CLANGF_SRC=`realpath -e "$1"`
6+
if [ ! -f "$1" ]; then
7+
echo "$1: no such file or directory" >&2
8+
exit 1
9+
fi
10+
fi
211

312
cd $(dirname $0)/../..
413

14+
CLANGF_DEST=src/.clang-format
15+
16+
rm -f "$CLANGF_DEST"
17+
18+
if [ -z "$CLANGF_SRC" ]; then
19+
CLANGF_SRC="src/.clang-format-commit"
20+
fi
21+
22+
cp "$CLANGF_SRC" "$CLANGF_DEST"
23+
24+
echo "Using \"$CLANGF_SRC\"..."
25+
526
docker build -t code-format tools/code-format
627
docker run --rm=true -v "$(pwd)":/repository --user "$(id -u):$(id -g)" -t code-format

0 commit comments

Comments
 (0)