From 2aa478eea6f72da3378262ef7e9bef4ee25e8e25 Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Sat, 30 Sep 2023 19:03:40 -0600 Subject: [PATCH] Move and correct defn The salient difference is that it uses -x when testing. --- _reformat-common.bash | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/_reformat-common.bash b/_reformat-common.bash index c5c82f0..bafb4f1 100644 --- a/_reformat-common.bash +++ b/_reformat-common.bash @@ -103,18 +103,6 @@ function custom_sniff() { fi } -function custom_formatter() { - root="$1" - file_type="$2" - - maybe="$root/.would-reformat/$file_type" - if [[ -f "$maybe" ]]; then - echo "$maybe" - return - fi - - echo "use-default" -} ## WOULD_FORMAT_PROJECT_ROOT=$(project_root $1) @@ -165,6 +153,19 @@ function sniff_file_type() { echo $file_type } +function custom_formatter() { + root="$1" + file_type="$2" + + maybe="$root/.would-reformat/$file_type" + if [[ -x "$maybe" ]]; then + echo -n "$maybe" + return + fi + + echo "" +} + function choose_wrapper() { file_type="$1"