pretty pretty
This commit is contained in:
parent
24c6fa4a7f
commit
15bba163f8
1 changed files with 11 additions and 4 deletions
15
nswitch
15
nswitch
|
@ -5,6 +5,14 @@ set -E -o pipefail
|
|||
shopt -s failglob
|
||||
export LC_ALL=C.UTF8
|
||||
|
||||
exit_with_new_shell() {
|
||||
printf '\n'
|
||||
printf '>>> opening a new \"%s\" shell\n' "$(basename "$SHELL")"
|
||||
printf '>>> cwd: %s\n' "$(pwd)"
|
||||
"$SHELL"
|
||||
exit 0
|
||||
}
|
||||
|
||||
cd ~/Projects/NixOS/ || exit 1
|
||||
nvim
|
||||
|
||||
|
@ -12,14 +20,13 @@ printf ">>> auto formating ..."
|
|||
nix fmt . &> /dev/null
|
||||
printf " DONE!\n"
|
||||
|
||||
[ -z "$(git diff -U0)" ] && echo ">>> no changes, exiting ..." && "$SHELL" && exit 0
|
||||
[ -z "$(git diff -U0)" ] && echo ">>> no changes, exiting ..." && exit_with_new_shell
|
||||
git diff -U0 # "*.nix" # as a seperate command so we get nice colors and pager
|
||||
|
||||
printf ">>> Do you want to rebuild NixOS? [y/N]\n"
|
||||
printf "<<< " && read -r YESNO
|
||||
if ! [[ "${YESNO,,}" == "y" ]]; then
|
||||
printf ">>> Exiting ...\n"
|
||||
exit 1
|
||||
exit_with_new_shell
|
||||
fi
|
||||
|
||||
printf ">>> Rebuilding NixOS\n"
|
||||
|
@ -28,4 +35,4 @@ sudo nixos-rebuild switch | tee nixos-switch.log || (
|
|||
gen=$(nixos-rebuild list-generations | grep current)
|
||||
git commit -am "$gen"
|
||||
|
||||
"$SHELL"
|
||||
exit_with_new_shell
|
||||
|
|
Loading…
Add table
Reference in a new issue