Skip to content

Instantly share code, notes, and snippets.

@kigster
Last active December 18, 2019 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kigster/8ef96281d22de4a41014aaddf2d1cb0d to your computer and use it in GitHub Desktop.
Save kigster/8ef96281d22de4a41014aaddf2d1cb0d to your computer and use it in GitHub Desktop.
BashMatic bootstrapper for curl-based installations. To install BashMatic using this, run the following command: `eval "$(curl -fsSL http://bit.ly/bashmatic-v0-1-0)"`
#!/usr/bin/env bash
# vim: ft=sh
[[ -z $(command -v git) ]] && {
echo "Please install xcode-tools on MacOSX, or git on Linux before running this script."
exit 1
}
export BashMatic="${HOME}/.bashmatic"
if [[ ! -f "${BashMatic}/init.sh" || ! -d "${BashMatic}" ]] ; then
rm -rf "${BashMatic}" 2>/dev/null
git clone https://github.com/kigster/bashmatic "${BashMatic}" 1>/dev/null 2>&1
else
set +e # ignore errors here
cd "${BashMatic}" && git pull -q && cd - >/dev/null
fi
set -e
# Load the library
source "${BashMatic}"/init.sh
# Add a hook to ~/.bashrc
bashmatic.load-at-login
# Add a banner.
box::yellow-in-red "Welcome to BashMatic version ${bldylw}${BashMatic__Version}" \
"It has been installed in your home folder, inside ${BashMatic} directory." \
"Start a new Shell so that BashMatic loads, and checkout the pre-loaded " \
"functions that start with 'bashmatic.*' — they have useful helpers for " \
"using this library."
success "BashMatic installed successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment