Skip to content

Commit fbe2d95

Browse files
Added -g (SGROUP) option to the cloning script.
1 parent 45735a1 commit fbe2d95

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

mcp_git_clone.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
# on a new branch named "mcp_main" to avoid modifying the
6565
# original contents of the source repository to be cloned.
6666
#
67+
# -g SGROUP (subgroup) is optional. This is used to select a pre-
68+
# existing subgroup in the Unity group of the Unity MCP GitLab
69+
# account. If provided, the remote repository will be cloned
70+
# in the specified subgroup. If not provided, the remote repo.
71+
# will be cloned directly inside the Unity group.
72+
#
6773
# WARNING:
6874
# - There is no strong error checking implemented yet.
6975
# - There are no prompts to confirm the users actions yet.
@@ -87,7 +93,7 @@
8793
# Prints usage message
8894
#
8995
usage() {
90-
echo "Usage: $0 [ PATH ] [ -b BRANCH ] [ -m MESSAGE ] [ -t TOKEN_NAME:TOKEN ] [ -p PIPELINE ]" 1>&2
96+
echo "Usage: $0 [ PATH ] [ -b BRANCH ] [ -m MESSAGE ] [ -t TOKEN_NAME:TOKEN ] [ -p PIPELINE ] [ -g SGROUP ]" 1>&2
9197
}
9298

9399
# This function is for error exit.
@@ -106,12 +112,13 @@ branch="main"
106112
message="initial revision"
107113
tauthentication=""
108114
pipeline=""
115+
sgroup=""
109116

110117
ipos=0
111118
while [ $# -gt 0 ]; do
112119
unset OPTIND
113120
unset OPTARG
114-
while getopts hb:m:t:p: opt; do
121+
while getopts hb:m:t:p:g: opt; do
115122
if [[ ${OPTARG} =~ ^-.*$ ]]; then
116123
echo "ERROR: Option argument cannot start with '-'"
117124
exit_abnormal
@@ -122,6 +129,7 @@ while [ $# -gt 0 ]; do
122129
m) message=${OPTARG};;
123130
t) tauthentication=${OPTARG};;
124131
p) pipeline=`realpath ${OPTARG}`;;
132+
g) sgroup=${OPTARG};;
125133
*) echo "ERROR: Unknown option."; exit_abnormal;;
126134
esac
127135
done
@@ -144,6 +152,7 @@ echo "branch '$branch'"
144152
echo "message '$message'"
145153
echo "token '$tauthentication'"
146154
echo "pipeline '$pipeline'"
155+
echo "sgroup '$sgroup'"
147156
echo "path '$path'"
148157

149158

@@ -323,6 +332,10 @@ if [ -z "$result" ]; then
323332
gitlaburl="https://$tauthentication@gitlab.mcp.nasa.gov/unity/"
324333
fi
325334

335+
if [ -n "$sgroup" ]; then
336+
gitlaburl="$gitlaburl$sgroup/"
337+
fi
338+
326339
# The current subdirectory name (last token of PWD) is
327340
# chosen as the project name.
328341
#

0 commit comments

Comments
 (0)