IMP(shfmt): add shell formatter

This commit is contained in:
Thibault Ayanides
2020-12-04 14:08:01 +01:00
parent bc1aa65b91
commit 3a342b784a
300 changed files with 2370 additions and 2427 deletions

23
lib/shellfmt/launch_shellfmt.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# run-shellcheck
if [ ! -f tmp/shfmt ]; then
wget -O tmp/shfmt https://github.com/mvdan/sh/releases/download/v3.2.0/shfmt_v3.2.0_linux_amd64
fi
chmod +x tmp/shfmt
files=""
retval=0
if [ "$#" -eq 0 ]; then
files=$(find . -name "*.sh" | sort -V)
else
files="$*"
fi
for f in $files; do
./tmp/shfmt -l -i 4 -w "$f"
done
exit "$retval"