From 5a70f07e37c818b54a802dc0ca806e342ed2acf8 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Sun, 3 Nov 2024 07:34:41 -0600 Subject: [PATCH] Support passing files and directories as arguments to nixfmt-plus script --- .../_mixins/scripts/nixfmt-plus/nixfmt-plus.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/home-manager/_mixins/scripts/nixfmt-plus/nixfmt-plus.sh b/home-manager/_mixins/scripts/nixfmt-plus/nixfmt-plus.sh index 33ad26868..1124846b8 100755 --- a/home-manager/_mixins/scripts/nixfmt-plus/nixfmt-plus.sh +++ b/home-manager/_mixins/scripts/nixfmt-plus/nixfmt-plus.sh @@ -1,5 +1,14 @@ #!/usr/bin/env bash +set -eou pipefail -deadnix --edit -statix fix -nixfmt --verify . +if [ $# -eq 0 ]; then + deadnix --edit + statix fix + nixfmt --verify . +else + deadnix --edit "$@" + for target in "$@"; do + statix fix -- "$target" + done + nixfmt --verify "$@" +fi