@@ -13,8 +13,6 @@ ROOT="$(realpath "$(dirname "$0")"/../)"
1313# Standard color definitions
1414GREEN=" \033[32m"
1515RED=" \033[31m"
16- BLUE=" \033[94m"
17- BOLD=" \033[1m"
1816NORMAL=" \033[0m"
1917
2018# utility
@@ -29,36 +27,36 @@ error()
2927}
3028
3129info " Formatting nix files"
32- if ! command -v nixpkgs-fmt 2>&1 > /dev/null; then
30+ if ! command -v nixpkgs-fmt > /dev/null 2>&1 ; then
3331 error " nixpkgs-fmt not found. Are you running in a nix shell? See BUILDING.md."
3432 exit 1
3533fi
3634
3735nixpkgs-fmt " $ROOT "
3836
3937info " Formatting shell scripts"
40- if ! command -v shfmt 2>&1 > /dev/null; then
38+ if ! command -v shfmt > /dev/null 2>&1 ; then
4139 error " shfmt not found. Are you running in a nix shell? See BUILDING.md."
4240 exit 1
4341fi
44- shfmt -s -w -l -i 2 -ci -fn $( shfmt -f $( git grep -l ' ' :/) )
42+ shfmt -s -w -l -i 2 -ci -fn " $( shfmt -f " $( git grep -l ' ' :/) " ) "
4543
4644info " Formatting python scripts"
47- if ! command -v black 2>&1 > /dev/null; then
45+ if ! command -v black > /dev/null 2>&1 ; then
4846 error " black not found. Are you running in a nix shell? See BUILDING.md."
4947 exit 1
5048fi
5149black --include " (scripts/tests|scripts/simpasm|scripts/cfify|scripts/autogen|scripts/check-namespace|\.py$)" " $ROOT "
5250
5351info " Formatting c files"
54- if ! command -v clang-format 2>&1 > /dev/null; then
52+ if ! command -v clang-format > /dev/null 2>&1 ; then
5553 error " clang-format not found. Are you running in a nix shell? See BUILDING.md."
5654 exit 1
5755fi
5856
5957nproc=$( getconf _NPROCESSORS_ONLN || echo 1)
6058
61- git ls-files -- " :/*.c" " :/*.h" | xargs -P $nproc -I {} sh -c '
59+ git ls-files -- " :/*.c" " :/*.h" | xargs -P " $nproc " -I {} sh -c '
6260 # Ignore symlinks
6361 if [[ ! -L {} ]]; then
6462 clang-format -i {}
@@ -67,7 +65,7 @@ git ls-files -- ":/*.c" ":/*.h" | xargs -P $nproc -I {} sh -c '
6765info " Checking for eol"
6866check-eol ()
6967{
70- git ls-files -- " :/" " :/!:*.png" | xargs -P $nproc -I {} sh -c '
68+ git ls-files -- " :/" " :/!:*.png" | xargs -P " $nproc " -I {} sh -c '
7169 # Ignore symlinks
7270 if [[ ! -L {} && $(tail -c1 "{}" | wc -l) == 0 ]]; then
7371 echo "" >>"{}"
0 commit comments