diff options
author | EuAndreh <eu@euandre.org> | 2020-12-24 20:24:05 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-12-24 20:31:46 -0300 |
commit | 15c4774f17f67eb69a0162390b77201e7817fe94 (patch) | |
tree | 3adf4a6a62dd9fea579dd9bbcbf6cacc03c1bf98 /scripts/assert-nixfmt.sh | |
parent | Use MKV over webm (diff) | |
download | euandre.org-15c4774f17f67eb69a0162390b77201e7817fe94.tar.gz euandre.org-15c4774f17f67eb69a0162390b77201e7817fe94.tar.xz |
Use /bin/sh over Bash
Diffstat (limited to '')
-rwxr-xr-x | scripts/assert-nixfmt.sh | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/scripts/assert-nixfmt.sh b/scripts/assert-nixfmt.sh index 7a68fa9..761c1e2 100755 --- a/scripts/assert-nixfmt.sh +++ b/scripts/assert-nixfmt.sh @@ -1,16 +1,8 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" -cd ../ +#!/bin/sh -eux -format() { - nix_file="${1}" - diff <(nixfmt < "${nix_file}") "${nix_file}" || { - echo "The file '${nix_file}' is unformatted. To fix it, run:" - echo " nixfmt ${nix_file}" - exit 1 - } +# shellcheck disable=2094 +nixfmt < default.nix | diff - default.nix || { + echo 'The file default.nix is unformatted. To fix it, run:' + echo ' nixfmt default.nix' + exit 1 } -export -f format - -find . -type f -name '*.nix' -print0 | xargs -0 -I% bash -c "format %" |