Skip to content

Commit

Permalink
Small fix to format.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
llaniewski committed Jun 3, 2024
1 parent 39adcdf commit 4570daa
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions tools/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function formatR {
}

function formatXML {
sed '/./,$!d' | xmllint -
export XMLLINT_INDENT=" "
sed '/./,$!d' | xmllint --format -
}

function formatSH {
Expand Down Expand Up @@ -74,22 +75,21 @@ function format_sel {
echo formatKEEP
return 0
fi
case "$(head -n 1 $1)" in
*bash)
echo formatSH
return 0
;;
*R | *Rscript)
echo formatR
return 0
;;
*)
echo formatKEEP
return 0
;;
esac
if head -1 "$1" | grep -q "^#!"
then
case "$(head -n 1 $1)" in
*bash)
echo formatSH
return 0
;;
*R | *Rscript)
echo formatR
return 0
;;
esac
fi
echo formatKEEP
return -1
return 0
}

function format_to {
Expand Down Expand Up @@ -232,9 +232,7 @@ while test -n "$1"; do
if ! test -z "$DIFFTOOL"; then
$DIFFTOOL "$OUTFILE" "$INFILE"
fi
if test -z "$OUTFILE"; then
OUTFILE=""
fi
OUTFILE=""
;;
esac
shift
Expand Down

0 comments on commit 4570daa

Please sign in to comment.