Skip to content

Commit 4258c1c

Browse files
committed
Add the -c flag to formatting scripts
1 parent 928144e commit 4258c1c

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

devtools/format_md.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,13 @@
22
set -o errexit -o nounset -o pipefail
33
command -v shellcheck >/dev/null && shellcheck "$0"
44

5-
npx [email protected] --write "./**/*.md"
5+
# Running with -c makes the script only validate instead of editing in place.
6+
op="write"
7+
while getopts c option; do
8+
case "${option}" in
9+
10+
c) op="check" ;;
11+
esac
12+
done
13+
14+
npx [email protected] --$op "./**/*.md"

devtools/format_sh.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,13 @@
22
set -o errexit -o nounset -o pipefail
33
command -v shellcheck >/dev/null && shellcheck "$0"
44

5-
shfmt -w devtools packages
5+
# Running with -c makes the script only validate instead of editing in place.
6+
op="w"
7+
while getopts c option; do
8+
case "${option}" in
9+
10+
c) op="d" ;;
11+
esac
12+
done
13+
14+
shfmt -$op devtools packages

devtools/format_yml.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,13 @@
22
set -o errexit -o nounset -o pipefail
33
command -v shellcheck >/dev/null && shellcheck "$0"
44

5-
npx [email protected] --write "./**/*.yml"
5+
# Running with -c makes the script only validate instead of editing in place.
6+
op="write"
7+
while getopts c option; do
8+
case "${option}" in
9+
10+
c) op="check" ;;
11+
esac
12+
done
13+
14+
npx [email protected] --$op "./**/*.yml"

0 commit comments

Comments
 (0)