1
0
Fork 1
mirror of https://example.com synced 2024-11-23 02:36:38 +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 0a29467541
commit ddbf884cb5
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 fi
done done
say 'Do you use Docker or Podman?' docker_update() {
printf 'd: Docker, p: Podman, n: No [d/p/N] > ' ./neko/update/container.sh 'docker' "$@"
read -r resp }
podman_update() {
./neko/update/container.sh 'podman' "$@"
}
native_update() {
./neko/update/native.sh "$@"
}
case "${resp}" in if contains '--docker' "$@"; then docker_update "$@"
[Dd]) elif contains '--podman' "$@"; then podman_update "$@"
./neko/update/docker.sh 'docker' "$@" elif contains '--native' "$@"; then native_update "$@"
;;
[Pp]) else
./neko/update/docker.sh 'podman' "$@" say 'Do you use Docker or Podman?'
;; printf 'd: Docker, p: Podman, n: No [d/p/N] > '
[Yy]|[Yy][Ee][Ss]) read -r resp
sadsay "Watch out! ${resp} is not a valid answer." >&2
exit 1 case "${resp}" in
;; [Yy]|[Yy][Ee][Ss])
*) sadsay "Watch out! ${resp} is not a valid answer." >&2
./neko/update/native.sh "$@" exit 1
;; ;;
esac [Dd]) docker_update "$@" ;;
[Pp]) podman_update "$@" ;;
*) native_update "$@" ;;
esac
fi
# Done # Done
say 'Enjoy your sabakan life~' say 'Enjoy your sabakan life~'