-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-aepl-nb-f
67 lines (60 loc) · 1.06 KB
/
git-aepl-nb-f
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
#
# git-aepl-nb-f - Create a new feature branch catering the standards of
# Automotive Exchange Pvt. Ltd.
#
# Dependency - git-aepl-nb
#
# Author:
# Navead Kazi
#
id=
name=
help(){
echo "help: git aepl-nb-f"
echo
echo "Mandatory options are:"
echo " -i | --id Pivotal Tracker Id of the task."
echo " -n | --name Name of the branch."
}
createBranch(){
git checkout -b f-$id-$name
}
notify(){
while true; do
read -p "You are creating a branch: f-$id-$name.
Do you want to continue (y/n) > " yn
case $yn in
[Yy]* ) createBranch; break;;
[Nn]* ) exit;;
* ) echo "Please answer y or n.";;
esac
done
}
main(){
while [ "$1" != "" ]; do
case $1 in
-i | --id ) shift
string=$1
id=${string,,}
shift
;;
-n | --name ) shift
string=$1
name=${string,,}
shift
;;
*)
shift;;
esac
done
if [ "$id" = "" ] || [ "$name" = "" ]; then
echo "Please provide mandatory options"
echo
help
else
notify
fi
}
main "$@"
exit 0