Move wrapper selection into a function
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user