Try to do a few things
FIXME: do them correctly; squash and reword this travesty of a commit.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
function log () {
|
||||||
|
msg=$@
|
||||||
|
|
||||||
|
if [[ ! -z "${LOG_TO+}" ]] ; then
|
||||||
|
echo "$msg" >> $LOG_TO
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function get_os() {
|
function get_os() {
|
||||||
un=$(uname)
|
un=$(uname)
|
||||||
|
|
||||||
@@ -139,12 +147,13 @@ function sniff_file_type() {
|
|||||||
file_type="css"
|
file_type="css"
|
||||||
elif [[ $ff == *.scss ]]; then
|
elif [[ $ff == *.scss ]]; then
|
||||||
file_type="scss"
|
file_type="scss"
|
||||||
elif [[ $ff = *.sh ]]; then
|
|
||||||
file_type="sh"
|
|
||||||
elif [[ $ff = *.go ]]; then
|
elif [[ $ff = *.go ]]; then
|
||||||
file_type="golang"
|
file_type="golang"
|
||||||
elif [[ $ff = *.dart ]]; then
|
elif [[ $ff = *.dart ]]; then
|
||||||
file_type="dart"
|
file_type="dart"
|
||||||
|
elif [[ $ff = *.sh ]]; then
|
||||||
|
# .sh isn't enough; we'll need other extns
|
||||||
|
file_type="shell"
|
||||||
elif [[ $ff = *.pl ]]; then
|
elif [[ $ff = *.pl ]]; then
|
||||||
file_type="perl"
|
file_type="perl"
|
||||||
elif [[ $ff = *.rs ]] ; then
|
elif [[ $ff = *.rs ]] ; then
|
||||||
@@ -186,8 +195,7 @@ function choose_wrapper() {
|
|||||||
$file_type = "jsx" ||
|
$file_type = "jsx" ||
|
||||||
$file_type = "tsx" ||
|
$file_type = "tsx" ||
|
||||||
$file_type == "css" ||
|
$file_type == "css" ||
|
||||||
$file_type == "scss" ||
|
$file_type == "scss" ]]; then
|
||||||
$file_type = "sh" ]]; then
|
|
||||||
out="$WF_ROOT"/./prettier.sh
|
out="$WF_ROOT"/./prettier.sh
|
||||||
elif [[ $file_type == "python" ]]; then
|
elif [[ $file_type == "python" ]]; then
|
||||||
out="$WF_ROOT"/./isort-and-black.sh
|
out="$WF_ROOT"/./isort-and-black.sh
|
||||||
@@ -197,6 +205,8 @@ function choose_wrapper() {
|
|||||||
out="$WF_ROOT"/./rustfmt.sh
|
out="$WF_ROOT"/./rustfmt.sh
|
||||||
elif [[ $file_type == "dart" ]]; then
|
elif [[ $file_type == "dart" ]]; then
|
||||||
out="$WF_ROOT"/./dart_format.sh
|
out="$WF_ROOT"/./dart_format.sh
|
||||||
|
elif [[ $file_type == "shell" ]] ; then
|
||||||
|
out="$WF_ROOT"/./shfmt.sh
|
||||||
else
|
else
|
||||||
out="$WF_ROOT"/./default.sh
|
out="$WF_ROOT"/./default.sh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
|
|
||||||
source "$DIR/_reformat-common.bash"
|
source "$DIR/_reformat-common.bash"
|
||||||
|
|
||||||
|
#export LOG_DEST="$LOG_TO"
|
||||||
|
|
||||||
file="$1"
|
file="$1"
|
||||||
|
|
||||||
PROJECT_ROOT=$(project_root "$file")
|
PROJECT_ROOT=$(project_root "$file")
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
# wrflog before sourcing common funcs, I think i am in dir: $(pwd)
|
# wrflog before sourcing common funcs, I think i am in dir: $(pwd)
|
||||||
source "$DIR/_reformat-common.bash"
|
source "$DIR/_reformat-common.bash"
|
||||||
|
|
||||||
|
#export LOG_DEST="$LOG_TO"
|
||||||
|
|
||||||
|
log "is this thing on"
|
||||||
|
|
||||||
|
log i think it is on
|
||||||
|
|
||||||
file="$1"
|
file="$1"
|
||||||
PROJECT_ROOT=$(project_root "$file")
|
PROJECT_ROOT=$(project_root "$file")
|
||||||
export PROJECT_ROOT="$PROJECT_ROOT"
|
export PROJECT_ROOT="$PROJECT_ROOT"
|
||||||
@@ -24,11 +30,19 @@ export WOULD_REFORMAT=would_reformat
|
|||||||
|
|
||||||
wrapper=$(choose_wrapper "$file_type")
|
wrapper=$(choose_wrapper "$file_type")
|
||||||
|
|
||||||
|
log wrapper is "$wrapper"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
echo asdf
|
||||||
out=$("$wrapper" "$file" 2>&1 >/dev/null)
|
out=$("$wrapper" "$file" 2>&1 >/dev/null)
|
||||||
retval="$?"
|
retval="$?"
|
||||||
|
echo fdsa
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
echo retval "$retval"
|
||||||
|
|
||||||
success_retval=0
|
success_retval=0
|
||||||
would_reformat_retval=1
|
would_reformat_retval=1
|
||||||
syntax_error_retval=2
|
syntax_error_retval=2
|
||||||
|
|||||||
Reference in New Issue
Block a user