File: shfmt-format-all.sh

package info (click to toggle)
mongo-c-driver 2.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 49,532 kB
  • sloc: ansic: 197,016; python: 7,890; cpp: 2,343; sh: 693; makefile: 77
file content (32 lines) | stat: -rwxr-xr-x 676 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
#
# format.sh
#
# Usage:
#   uv run --frozen etc/shfmt-format-all.sh
#
# This script is meant to be run from the project root directory.

set -o errexit
set -o pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root_dir="$(cd "${script_dir:?}/.." && pwd)"

command -v find >/dev/null

include=(
  "${root_dir:?}/.evergreen"
  "${root_dir:?}/src"
  "${root_dir:?}/tools"
)

exclude=(
  "${root_dir:?}/.evergreen/scripts/uv-installer.sh"
)

mapfile -t files < <(find "${include[@]:?}" -name '*.sh' -type f | grep -v "${exclude[@]:?}")

for file in "${files[@]:?}"; do
  uv run --frozen --group format-scripts shfmt -i 2 -w "${file:?}"
done