read env var

pull/3/head
kevin zhuang 4 years ago
parent 5204022e2c
commit 762a62c079

@ -6,17 +6,22 @@
# Globals
# ${action_command}: string, determine which script to call
# Arguments
# None
# command: command to run general git command/fadd/frm/fpop etc
# $opt: options flag -h -p etc
mydir="${0%/*}"
# check env variable
[[ -z "${DOTBARE_DIR}" ]] && DOTBARE_DIR="$Home/.cfg/"
[[ -z "${DOTBARE_TREE}" ]] && DOTBARE_TREE="$HOME"
function usage() {
echo "help"
}
# if no argument passed in, let git display help message
if [[ -z "$@" ]]; then
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}"
exit 0
fi
@ -45,7 +50,7 @@ case "$1" in
esac
if [[ -z "${action_command}" ]]; then
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME "$@"
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" "$@"
else
# run the scripts
"${mydir}/scripts/${action_command}" "$@"

Loading…
Cancel
Save