no need to auto format if there is no change
This commit is contained in:
parent
5fa380223b
commit
e70b8beb7c
1 changed files with 5 additions and 1 deletions
6
nswitch
6
nswitch
|
@ -24,11 +24,15 @@ exit_with_new_shell() {
|
|||
cd "$PROJECT" || exit 1
|
||||
nvim
|
||||
|
||||
# check if there are changes at all
|
||||
[[ -z "$(git diff -U0 "$GIT_PATTERN")" ]] && echo ">>> no changes, exiting ..." && exit_with_new_shell
|
||||
|
||||
# only then do auto formating
|
||||
printf ">>> auto formating ..."
|
||||
nix fmt . &> /dev/null
|
||||
printf " DONE!\n"
|
||||
|
||||
[[ -z "$(git diff -U0 "$GIT_PATTERN")" ]] && echo ">>> no changes, exiting ..." && exit_with_new_shell
|
||||
# and then show the user a diff
|
||||
git diff -U0 "$GIT_PATTERN" # as a seperate command so we get nice colors and pager
|
||||
|
||||
printf ">>> Do you want to rebuild NixOS? [y/N]\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue