Skip to content

Commit ce2dfac

Browse files
author
Paul Dreik
committed
add script for formatting shell files
1 parent 36b1131 commit ce2dfac

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

do_shellfmt.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
me=$(basename "$0")
6+
7+
if ! which shfmt >/dev/null 2>&1; then
8+
echo "$me: please install shfmt"
9+
exit 1
10+
fi
11+
12+
echo "$me: run shfmt on shellscripts"
13+
(
14+
git ls-files | grep -E ".sh$" | xargs shfmt --indent 2 \
15+
--binary-next-line \
16+
--case-indent \
17+
--write
18+
)

0 commit comments

Comments
 (0)