From 9050c9792a879d8d253c514ed9112f50025b9504 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Wed, 29 Jul 2020 21:07:05 +0200 Subject: [PATCH] Improve bootstrap-haskell --- bootstrap-haskell | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/bootstrap-haskell b/bootstrap-haskell index 7b0c8cc..467a119 100755 --- a/bootstrap-haskell +++ b/bootstrap-haskell @@ -40,6 +40,22 @@ _eghcup() { fi } +_done() { + echo + echo "All done!" + echo + echo "To start a simple repl, run:" + echo " ghci" + echo + echo "To start a new haskell project in the current directory, run:" + echo " cabal init --interactive" + echo + echo "To install other GHC versions, run:" + echo " ghcup tui" + + exit 0 +} + download_ghcup() { _plat="$(uname -s)" _arch=$(uname -m) @@ -113,15 +129,18 @@ echo echo "Welcome to Haskell!" echo echo "This script will download and install the following binaries:" -echo " * ghcup - The Haskell toolchain installer (for managing GHC/cabal versions)" +echo " * ghcup - The Haskell toolchain installer" +echo " (for managing GHC/cabal versions)" echo " * ghc - The Glasgow Haskell Compiler" echo " * cabal - The Cabal build tool" echo if [ -z "${GHCUP_USE_XDG_DIRS}" ] ; then - echo "ghcup installs only into the following directory, which can be removed anytime:" + echo "ghcup installs only into the following directory," + echo "which can be removed anytime:" echo " $GHCUP_INSTALL_BASE_PREFIX/.ghcup" else - echo "ghcup installs into XDG directories as long as 'GHCUP_USE_XDG_DIRS' is set" + echo "ghcup installs into XDG directories as long as" + echo "'GHCUP_USE_XDG_DIRS' is set." fi echo @@ -189,13 +208,13 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then GHCUP_PROFILE_FILE="$HOME/.zshrc" MY_SHELL="zsh" else - exit 0 + _done fi ;; */fish) # login shell is fish GHCUP_PROFILE_FILE="$HOME/.config/fish/config.fish" MY_SHELL="fish" ;; - *) exit 0 ;; + *) _done ;; esac @@ -222,9 +241,10 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then esac printf "\\033[0;35m%s\\033[0m\\n" "OK! ${GHCUP_PROFILE_FILE} has been modified. Restart your terminal for the changes to take effect," printf "\\033[0;35m%s\\033[0m\\n" "or type \"source ${GHCUP_DIR}/env\" to apply them in your current terminal session." - exit 0;; + _done + ;; [Nn]*) - exit 0;; + _done ;; *) echo "Please type YES or NO and press enter.";; esac