adds help function and improves parameter handling in upgrade script
Some checks failed
Nix Format Check / check-format (push) Failing after 36s

This commit is contained in:
2024-12-11 14:57:58 +01:00
parent 20a4b6b529
commit 84019d2ba8

View File

@ -1,12 +1,24 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
help() {
printfe "%s\n" "green" "Usage: upgrade.sh [options]"
printfe "%s\n" "green" "Options:"
printfe "%s\n" "green" " --ha, -H Upgrade Home Manager packages."
printfe "%s\n" "green" " --nix, -X Upgrade NixOS packages."
printfe "%s\n" "green" " --full-speed, -F Upgrade packages and use all available cores for compilation. (Default: 8 cores)"
printfe "%s\n" "green" " --help, -h Display this help message."
exit 0
}
while [[ "$#" -gt 0 ]]; do
case $1 in
--ha) RUN_HA=true ;;
--nix) RUN_NIX=true ;;
--full-speed) FULL_SPEED=true ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
--ha|-H) RUN_HA=true ;;
--nix|-X) RUN_NIX=true ;;
--full-speed|-F) FULL_SPEED=true ;;
--help|-h) help ;;
*) echo "Unknown parameter passed: $1";
help ;;
esac
shift
done