-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-toolset.sh
executable file
·50 lines (42 loc) · 1.15 KB
/
git-toolset.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# Main script for gittem
gittem_home="$(dirname "$(readlink -f "$0")")"
source "${gittem_home}/src/lib/io.sh"
function version() {
echo "Git gittem version 0.1.1"
}
function usage(){
echo "$(basename $0) [-h] -- Git hooks manager and tipper.
where
-h --help Show this help.
-g --global Runs global configuration script.
-i --install Installs hooks in the current project folder.
-v --version Shows the current version.
"
}
# options may be followed by one colon to indicate they have a required argument
if ! options=$(getopt -o bcghistv -l branch,crud,global,help,install,stage,tips,vesion -- "$@")
then
# something went wrong, getopt will put out an error message for us
exit 1
fi
if [ $# -eq 0 ]; then
echo "No arguments provided."
usage
exit
fi
set -- $options
while [ $# -gt 0 ]
do
case $1 in
-g|--global) ${gittem_home}/src/global_setup.sh;;
-h|--help) usage ;;
-i|--install) ${gittem_home}/src/hook_setup.sh $(io::clean $(pwd)) ;;
-v|--version) version ;;
--) shift;break;;
-*) echo "$0: error - unrecognized option $2" 1>&2; exit 1;;
*) break;;
esac
shift
done