From eb54e1b5180383204cac0620c1650b2d2c1ca541 Mon Sep 17 00:00:00 2001 From: ranomier Date: Fri, 13 Dec 2024 20:04:00 +0100 Subject: [PATCH] make it look nicer --- nswitch | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/nswitch b/nswitch index 69c75af..7f5e213 100755 --- a/nswitch +++ b/nswitch @@ -7,18 +7,22 @@ export LC_ALL=C.UTF8 cd ~/Projects/NixOS/ nvim -nix fmt . &>/dev/null -git diff -U0 *.nix -echo "Do you want to rebuild NixOS? [y/N]" -read -r YESNO +printf ">>> auto formating ..." +nix fmt . &> /dev/null +printf " DONE!\n" + +git diff -U0 # "*.nix" + +printf ">>> Do you want to rebuild NixOS? [y/N]\n" +printf "<<< " && read -r YESNO if ! [[ "${YESNO,,}" == "y" ]]; then - echo "Exiting ..." + printf ">>> Exiting ...\n" exit 1 fi -echo "Rebuilding NixOS" -sudo nixos-rebuild switch &>nixos-switch.log || ( - cat nixos-switch.log | grep --color error && false) +printf ">>> Rebuilding NixOS\n" +sudo nixos-rebuild switch | tee nixos-switch.log || ( + grep --color error nixos-switch.log && false) gen=$(nixos-rebuild list-generations | grep current) git commit -am "$gen"