30 lines
517 B
Bash
Executable File
30 lines
517 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -uo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
source "$DIR/_reformat-common.bash"
|
|
|
|
file="$1"
|
|
|
|
wrflog running against file "$file"
|
|
|
|
if [[ "$WOULD_REFORMAT" = "would_reformat" ]] ; then
|
|
out=$(npx prettier --check "$file" 2>&1 >/dev/null)
|
|
retval="$?"
|
|
echo "$out"
|
|
exit "$retval"
|
|
fi
|
|
|
|
if [[ "$WOULD_REFORMAT" = "do_reformat" ]] ; then
|
|
out=$(npx prettier --write "$file" 2>&1 >/dev/null)
|
|
retval="$?"
|
|
|
|
echo "$out"
|
|
exit "$retval"
|
|
fi
|
|
|
|
exit 255
|