Get and use PROJECT_ROOT and WF_ROOT early

This commit is contained in:
Michael Wolf
2023-09-30 17:28:23 -06:00
parent e587f8aebe
commit bb9b380382

View File

@@ -13,6 +13,8 @@ source "$DIR/_reformat-common.bash"
wrflog asdf asdf asdf
file="$1"
export PROJECT_ROOT=$(project_root "$file")
export WF_ROOT=$(wf_root)
## fixme use realpath or something on "$file"
@@ -39,12 +41,14 @@ if [[ $file_type = "javascript" || \
wrflog "$(wfroot "$DIR")"
wrflog "prettier: $(ls -l "$(wfroot "$DIR")"/./prettier.sh)"
out=$("$(wfroot "$DIR")"/./prettier.sh "$file" 2>&1 > /dev/null)
out=$("$WF_ROOT"/./prettier.sh "$file" 2>&1 >/dev/null)
retval="$?"
success_retval=0
would_reformat_retval=1
syntax_error_retval=2
elif [[ $file_type == "python" ]]; then
out=$("$(wfroot "$DIR")"/./isort-and-black.sh "$file" 2>&1 > /dev/null)
out=$("$WF_ROOT"/./isort-and-black.sh "$file" 2>&1 >/dev/null)
retval="$?"
success_retval=0
would_reformat_retval=1