From 6fae25b305d714b3ab7608fa003f1af9bf024545 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 14 Feb 2023 13:33:23 +0800 Subject: Rename tools into bin --- bin/install.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 bin/install.sh (limited to 'bin/install.sh') diff --git a/bin/install.sh b/bin/install.sh new file mode 100755 index 0000000..b6d6bde --- /dev/null +++ b/bin/install.sh @@ -0,0 +1,30 @@ +#! /usr/bin/env bash + +set -e + +# Default settings +SETTING_DIR=${SETTING_DIR:-~/helper} +REPO=${REPO:-typebrook/helper} +REMOTE=${REMOTE:-https://github.com/${REPO}.git} +BRANCH=${BRANCH:-dev} +RCFILE=${RCFILE:-~/.$(basename $SHELL)rc} + +if [ ! -d $SETTING_DIR ]; then + git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$SETTING_DIR" || { + error "git clone of helper repo failed" + exit 1 + } +fi + +# Write initial commands into .bashrc or .zshrc +sed -i'.bak' "\^# $REPO^, /^$/ d" $RCFILE +cat >>$RCFILE <