set up main script

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

@ -1 +1,52 @@
#!/bin/bash
#
# Main entry script for dotbare, used to route command to appropriate scripts
#
# @params
# Globals
# ${action_command}: string, determine which script to call
# Arguments
# None
mydir="${0%/*}"
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
exit 0
fi
action_command=''
case "$1" in
fadd)
action_command='fadd'
shift
;;
frm)
action_command='frm'
shift
;;
fpop)
action_command='fpop'
shift
;;
help)
usage
exit 0
;;
-h)
usage
exit 0
;;
esac
if [[ -z "${action_command}" ]]; then
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME "$@"
else
# run the scripts
"${mydir}/scripts/${action_command}" "$@"
fi

Loading…
Cancel
Save