Meta: Add confirmation for toolchain rebuilds if there's one already

This commit is contained in:
networkException 2022-09-12 19:42:28 +02:00 committed by Tim Flynn
parent 76f524c1d6
commit 40984d3355
Notes: sideshowbarker 2024-07-17 07:13:19 +09:00

View file

@ -311,6 +311,16 @@ ensure_toolchain() {
}
confirm_rebuild_if_toolchain_exists() {
[ ! -d "$TOOLCHAIN_DIR" ] && return
read -rp "You already have a toolchain, are you sure you want to delete and rebuild one [y/N]? " input
if [[ "$input" != "y" && "$input" != "Y" ]]; then
die "Aborted rebuild"
fi
}
delete_toolchain() {
[ ! -d "$TOOLCHAIN_DIR" ] || rm -rf "$TOOLCHAIN_DIR"
}
@ -482,6 +492,7 @@ elif [ "$CMD" = "delete" ]; then
elif [ "$CMD" = "rebuild-toolchain" ]; then
cmd_with_target
lagom_unsupported "The lagom target uses the host toolchain"
confirm_rebuild_if_toolchain_exists
delete_toolchain
ensure_toolchain
elif [ "$CMD" = "rebuild-world" ]; then