Skip to content

Commit 172128e

Browse files
committed
Refactor install.sh script to support the shell
1 parent a7a2c68 commit 172128e

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

install.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,25 @@ install_zsh() {
4444
}
4545

4646
main() {
47-
if [ -n "${ZSH_VERSION}" ]; then
48-
install_zsh
49-
elif [ "${SHELL}" = "/bin/bash" ]; then
50-
install_bash
51-
else
52-
echo "Current shell is not supported, aborting..."
53-
return 1
54-
fi
47+
local shell="$1"
48+
49+
case "${shell}" in
50+
"" | "bash")
51+
install_bash
52+
;;
53+
54+
"zsh")
55+
install_zsh
56+
;;
57+
58+
*)
59+
echo "No install script available for '${shell}'."
60+
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"
61+
return 1
62+
;;
63+
esac
5564

5665
echo "venv installed"
5766
}
5867

59-
main
68+
main "$@"

0 commit comments

Comments
 (0)