Skip to content

Commit c68b9c1

Browse files
Merge pull request #1 from crossroad0201/supports_aws_code_commit
Added support for AWS Code commit.
2 parents 995e915 + 557fd40 commit c68b9c1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

git-open

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,23 @@ elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git'
196196
# Keep project and repository name, append branch selector.
197197
providerBranchRef="?version=GB$branch"
198198
fi
199+
elif [[ "$domain" =~ amazonaws\.com$ ]]; then
200+
# AWS Code Commit
201+
# Take region name from domain.
202+
region=${domain#*.}
203+
region=${region%%.*}
204+
205+
# Replace domain.
206+
# Ex. git-codecommit.us-east-1.amazonaws.com -> us-east-1.console.aws.amazon.com
207+
domain="${region}.console.aws.amazon.com"
208+
209+
# Replace URL path.
210+
# Ex. v1/repos/example -> codecommit/home?region=us-east-1#/repository/example/browse/
211+
urlpath="codecommit/home?region=${region}#/repository/${urlpath##*/}/browse/"
212+
213+
# Replace branch ref.
214+
# Ex. /tree/foobar -> foobar/--/
215+
providerBranchRef="${providerBranchRef##*/}/--/"
199216
fi
200217

201218
openurl="$protocol://$domain/$urlpath"

0 commit comments

Comments
 (0)