Skip to content

Fixing install.sh so that the BASIC_ONLY option does not always skip the haskell installation. #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

PROGNAME=$(basename $0)
DEFAULT_REPO="https://github.com/begriffs/haskell-vim-now.git"
DEFAULT_GENERATE_HOOGLE_DB="y"
DEFAULT_GENERATE_HOOGLE_DB=true
DEFAULT_HVN_BASIC_ONLY=false

if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
Expand Down Expand Up @@ -117,7 +118,7 @@ do_setup() {
setup_tools
setup_vim $HVN_DEST

if test -z "$BASIC_ONLY"
if "$BASIC_ONLY"
then
setup_haskell $HVN_DEST $GENERATE_HOOGLE_DB
fi
Expand Down Expand Up @@ -149,30 +150,17 @@ function usage() {
exit 1
}

# $1: envvar
check_boolean_var() {
local var=$(eval "echo \$$1")
if test -n "$var" -a "$var" != y
then
>&2 echo "Error: Boolean envvar [$1] can only be empty or 'y'"
exit 1
fi
echo "ENV: [$1=$var]"
}

# command line args override env vars
HVN_REPO=${HVN_REPO:=$DEFAULT_REPO}
HVN_GENERATE_HOOGLE_DB=${HVN_GENERATE_HOOGLE_DB:=$DEFAULT_GENERATE_HOOGLE_DB}

check_boolean_var HVN_INSTALL_BASIC
check_boolean_var HVN_GENERATE_HOOGLE_DB
HVN_INSTALL_BASIC=${HVN_INSTALL_BASIC:=$DEFAULT_HVN_INSTALL_BASIC}

while test -n "$1"
do
case $1 in
--basic) shift; HVN_INSTALL_BASIC=y; continue;;
--basic) shift; HVN_INSTALL_BASIC=false; continue;;
--repo) shift; HVN_REPO=$1; shift; continue;;
--no-hoogle) shift; HVN_GENERATE_HOOGLE_DB=; continue;;
--no-hoogle) shift; HVN_GENERATE_HOOGLE_DB=false; continue;;
*) usage;;
esac
done
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ setup_haskell() {
msg "Installing git-hscope..."
cp ${HVN_DEST}/git-hscope ${STACK_BIN_PATH}

if test -n "$GENERATE_HOOGLE_DB"
if "$GENERATE_HOOGLE_DB"
then
msg "Building Hoogle database..."
${STACK_BIN_PATH}/hoogle generate
Expand Down