mirror of
https://github.com/nix-community/flakelight.git
synced 2025-03-14 22:18:11 +01:00
Format whole flake when fmt has no args
Now that Nix/Lix do not pass `.` by default for `nix fmt` we can take `nix fmt` without an arg to mean to format the entire flake.
This commit is contained in:
parent
0c583d705e
commit
836107752b
@ -42,7 +42,17 @@ in
|
||||
in
|
||||
pkgs.writeShellScriptBin "formatter" ''
|
||||
PATH=${if fullContext then "" else makeBinPath packages}
|
||||
if [ $# -eq 0 ]; then exec "$0" .; fi
|
||||
if [ $# -eq 0 ]; then
|
||||
flakedir=.
|
||||
while [ "$(${coreutils}/bin/realpath "$flakedir")" != / ]; do
|
||||
if [ -e "$flakedir/flake.nix" ]; then
|
||||
exec "$0" "$flakedir"
|
||||
fi
|
||||
flakedir="$flakedir/.."
|
||||
done
|
||||
echo Failed to find flake root! >&2
|
||||
exit 1
|
||||
fi
|
||||
for f in "$@"; do
|
||||
if [ -d "$f" ]; then
|
||||
${fd}/bin/fd "$f" -Htf -x "$0" &
|
||||
|
Loading…
Reference in New Issue
Block a user