Move wrapper selection into a function

This commit is contained in:
Michael Wolf
2023-09-30 18:14:47 -06:00
parent 9a752a45ba
commit 973b9e4c2f
3 changed files with 34 additions and 35 deletions

View File

@@ -165,6 +165,34 @@ function sniff_file_type() {
echo $file_type
}
function choose_wrapper() {
file_type="$1"
if [[ $file_type = "javascript" ||
$file_type = "vue" ||
$file_type = "typescript" ||
$file_type = "css" ||
$file_type = "php" ||
$file_type = "html" ||
$file_type = "jsx" ||
$file_type = "tsx" ||
$file_type == "css" ||
$file_type == "scss" ||
$file_type = "sh" ]]; then
out="$WF_ROOT"/./prettier.sh
elif [[ $file_type == "python" ]]; then
out="$WF_ROOT"/./isort-and-black.sh
elif [[ $file_type == "golang" ]]; then
out="$WF_ROOT"/./gofmt.sh
elif [[ $file_type == "dart" ]]; then
out="$WF_ROOT"/./dart_format.sh
else
out="$WF_ROOT"/./default.sh
fi
echo "$out"
}
function wrflog() {
echo "$@" >>/tmp/wrflog
}