From 9443f917b0f8a0efd78528af07f06a3b1c7a0b7a Mon Sep 17 00:00:00 2001 From: Stefan Mejlgaard Date: Thu, 4 Jan 2024 19:52:07 +0100 Subject: [PATCH] Refactor install.sh script to support specifying the shell --- install.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index 04a7764..a3bdfc9 100755 --- a/install.sh +++ b/install.sh @@ -44,16 +44,25 @@ install_zsh() { } main() { - if [ -n "${ZSH_VERSION}" ]; then - install_zsh - elif [ "${SHELL}" = "/bin/bash" ]; then - install_bash - else - echo "Current shell is not supported, aborting..." - return 1 - fi + local shell="$1" + + case "${shell}" in + "" | "bash") + install_bash + ;; + + "zsh") + install_zsh + ;; + + *) + echo "No install script available for '${shell}'." + echo "Use a different shell or install manually by adding 'source venv-cli/src/venv-cli/venv-cli.sh' to your shell's RC-file" + return 1 + ;; + esac echo "venv installed" } -main +main "$@"