Compare commits
3 commits
07c1c0f9c8
...
0093a34d48
Author | SHA1 | Date | |
---|---|---|---|
0093a34d48 | |||
deba4793f7 | |||
5ee1c7eddb |
2 changed files with 53 additions and 27 deletions
29
nswitch
29
nswitch
|
@ -14,6 +14,8 @@ exit_with_new_shell() {
|
||||||
# check if already in directory
|
# check if already in directory
|
||||||
[[ "$INITIAL_PWD" = "$PROJECT" ]] && printf '>>> already in directory\n' && exit 0
|
[[ "$INITIAL_PWD" = "$PROJECT" ]] && printf '>>> already in directory\n' && exit 0
|
||||||
|
|
||||||
|
cd "$PROJECT" || exit 1
|
||||||
|
|
||||||
printf '\n'
|
printf '\n'
|
||||||
printf '>>> opening a new \"%s\" shell\n' "$(basename "$SHELL")"
|
printf '>>> opening a new \"%s\" shell\n' "$(basename "$SHELL")"
|
||||||
printf ' cwd: %s\n' "$(pwd)"
|
printf ' cwd: %s\n' "$(pwd)"
|
||||||
|
@ -21,6 +23,7 @@ exit_with_new_shell() {
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quick_edit() {
|
||||||
cd "$PROJECT" || exit 1
|
cd "$PROJECT" || exit 1
|
||||||
nvim
|
nvim
|
||||||
|
|
||||||
|
@ -41,12 +44,38 @@ if ! [[ "${YESNO,,}" == "y" ]]; then
|
||||||
exit_with_new_shell
|
exit_with_new_shell
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf ">>> Add everything to git staging so nix can find it\n"
|
||||||
git add "$GIT_PATTERN"
|
git add "$GIT_PATTERN"
|
||||||
|
|
||||||
printf ">>> Rebuilding NixOS\n"
|
printf ">>> Rebuilding NixOS\n"
|
||||||
sudo nixos-rebuild switch | tee nixos-switch.log || (
|
sudo nixos-rebuild switch | tee nixos-switch.log || (
|
||||||
grep --color error nixos-switch.log && false)
|
grep --color error nixos-switch.log && false)
|
||||||
gen=$(nixos-rebuild list-generations | grep current)
|
gen=$(nixos-rebuild list-generations | grep current)
|
||||||
|
|
||||||
|
printf ">>> commiting to git\n"
|
||||||
git commit -am "$gen"
|
git commit -am "$gen"
|
||||||
|
|
||||||
exit_with_new_shell
|
exit_with_new_shell
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
help_msg() {
|
||||||
|
printf -- ' without arguments start the main loop\n'
|
||||||
|
printf -- '--help | -h -> show this message\n'
|
||||||
|
printf -- '--new-shell-in-project | -s -> show this message\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
quick_edit
|
||||||
|
elif [[ "$1" = "--help" || "$1" = "-h" ]]; then
|
||||||
|
help_msg
|
||||||
|
elif [[ "$1" = "--new-shell-in-project" || "$1" = "-s" ]]; then
|
||||||
|
exit_with_new_shell
|
||||||
|
else
|
||||||
|
help_msg
|
||||||
|
printf "=================\n"
|
||||||
|
printf "didn't recognise: %s\n" "$1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
|
@ -21,7 +21,4 @@ mkdir -p "$XDG_CONFIG_HOME"
|
||||||
printf 'Using profile: %s\n' "$XDG_CONFIG_HOME"
|
printf 'Using profile: %s\n' "$XDG_CONFIG_HOME"
|
||||||
#exit 0
|
#exit 0
|
||||||
|
|
||||||
# As of rustdesk 1.1.9 giving rustdesk unknown arguments crashes it with an address boundary error.
|
rustdesk "${*:2}"
|
||||||
# (At least on my machines)
|
|
||||||
# Thats why we are calling rustdesk without arguments, until thats solved
|
|
||||||
rustdesk #"${*:2}"
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue