1
0
Fork 1
mirror of https://example.com synced 2024-11-22 23:26:39 +09:00

dev: add ability to pass --docker, --podman, or --native to update.sh

passing more than one of these flags is not expected
This commit is contained in:
naskya 2024-01-09 10:50:34 +09:00
parent 9ea8c80127
commit 5ccb4e8049
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
2 changed files with 28 additions and 18 deletions

View file

@ -69,25 +69,35 @@ for message in $(find neko/messages -type f ! -name '*.resolved' -print | sort);
fi
done
docker_update() {
./neko/update/container.sh 'docker' "$@"
}
podman_update() {
./neko/update/container.sh 'podman' "$@"
}
native_update() {
./neko/update/native.sh "$@"
}
if contains '--docker' "$@"; then docker_update "$@"
elif contains '--podman' "$@"; then podman_update "$@"
elif contains '--native' "$@"; then native_update "$@"
else
say 'Do you use Docker or Podman?'
printf 'd: Docker, p: Podman, n: No [d/p/N] > '
read -r resp
case "${resp}" in
[Dd])
./neko/update/docker.sh 'docker' "$@"
;;
[Pp])
./neko/update/docker.sh 'podman' "$@"
;;
[Yy]|[Yy][Ee][Ss])
sadsay "Watch out! ${resp} is not a valid answer." >&2
exit 1
;;
*)
./neko/update/native.sh "$@"
;;
[Dd]) docker_update "$@" ;;
[Pp]) podman_update "$@" ;;
*) native_update "$@" ;;
esac
fi
# Done
say 'Enjoy your sabakan life~'