adds help function and improves parameter handling in upgrade script
Some checks failed
Nix Format Check / check-format (push) Failing after 36s
Some checks failed
Nix Format Check / check-format (push) Failing after 36s
This commit is contained in:
@ -1,12 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
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
|
while [[ "$#" -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--ha) RUN_HA=true ;;
|
--ha|-H) RUN_HA=true ;;
|
||||||
--nix) RUN_NIX=true ;;
|
--nix|-X) RUN_NIX=true ;;
|
||||||
--full-speed) FULL_SPEED=true ;;
|
--full-speed|-F) FULL_SPEED=true ;;
|
||||||
*) echo "Unknown parameter passed: $1"; exit 1 ;;
|
--help|-h) help ;;
|
||||||
|
*) echo "Unknown parameter passed: $1";
|
||||||
|
help ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user