From befc35c9639bd0360b44880ac5077dae8484a32d Mon Sep 17 00:00:00 2001 From: arnaudgolfouse Date: Fri, 9 Aug 2024 09:56:10 +0200 Subject: [PATCH] Improve the `fmt` script, and make it take arguments for rustfmt --- fmt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fmt b/fmt index cde960db68..04a340b871 100755 --- a/fmt +++ b/fmt @@ -2,7 +2,9 @@ # We use zsh instead of bash to enable globstar "**". # We don't instead run "shopt -s globstar", because shopt is not supported in Mac OS. -SCRIPTPATH=$(dirname "$BASH_SOURCE") +set -e + +SCRIPTPATH=${0:a:h} pushd $SCRIPTPATH > /dev/null -rustfmt **/*.rs +rustfmt $@ **/*.rs popd > /dev/null