Start extracting language-specific formatters

This commit is contained in:
Michael Wolf
2023-09-18 16:44:26 -06:00
parent d1e6e953d1
commit 2cc53eb7e1
5 changed files with 72 additions and 4 deletions

View File

@@ -5,12 +5,20 @@ IFS=$'\n\t'
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$DIR/_reformat-common.bash"
wrflog asdf asdf asdf
file="$1"
source "$DIR/_reformat-common.sh"
## fixme use realpath or something on "$file"
file_type=$(sniff_file_type $file)
wrflog got file_type $file_type
if [[ $file_type = "javascript" || \
$file_type = "vue" || \
$file_type = "typescript" || \
@@ -22,7 +30,10 @@ if [[ $file_type = "javascript" || \
$file_type == "css" || \
$file_type == "scss" || \
$file_type = "sh" ]]; then
out=$(npx prettier --check $file 2>&1 >/dev/null)
wrflog will run thing
wrflog "$(wfroot $DIR)"
wrflog "prettier: $(ls -l $(wfroot $DIR)/./prettier.sh)"
out=$(WOULD_REFORMAT=would_reformat $(wfroot $DIR)/./prettier.sh $file 2>&1 > /dev/null)
retval="$?"
success_retval=0
would_reformat_retval=1