You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dotbare/dotbare

64 lines
1.2 KiB
Plaintext

4 years ago
#!/bin/bash
#
# Main entry script for dotbare, used to route command to appropriate scripts
#
# @params
# Globals
# ${mydir}: string, directory of the executing script, used for sourcing helpers
# ${action_command}: string, determine which script to call
# Arguments
4 years ago
# command: command to run general git command/fadd/frm/fpop etc
# $opt: options flag -h -p etc
mydir="${0%/*}"
source "${mydir}"/helper/set_variable
4 years ago
function usage() {
echo "help"
}
# if no argument passed in, let git display help message
if [[ -z "$@" ]]; then
4 years ago
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}"
exit 0
fi
action_command=''
case "$1" in
fadd)
action_command='fadd'
shift
;;
frm)
action_command='frm'
shift
;;
fpop)
action_command='fpop'
shift
;;
4 years ago
freset)
action_command='freset'
shift
;;
4 years ago
fcheckout)
action_command='fcheckout'
shift
;;
help)
usage
exit 0
;;
-h)
usage
exit 0
;;
esac
if [[ -z "${action_command}" ]]; then
4 years ago
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" "$@"
else
# run the scripts
"${mydir}/scripts/${action_command}" "$@"
fi