Skip to content

Commit a223125

Browse files
sixther-dcericdduan
and
ericdduan
authored
Added support for cnb.cool. (#217)
Co-authored-by: ericdduan <[email protected]>
1 parent 2a66fcd commit a223125

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ git-open can automatically guess the corresponding repository page for remotes
128128
- Visual Studio Team Services
129129
- Team Foundation Server (on-premises)
130130
- AWS Code Commit
131+
- cnb.cool
131132
132133
## Configuration
133134

git-open

+9-1
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,16 @@ elif [[ "$domain" =~ amazonaws\.com$ ]]; then
246246
# Replace branch ref.
247247
# Ex. /tree/foobar -> foobar/--/
248248
providerBranchRef="${providerBranchRef##*/}/--/"
249+
elif [[ "$domain" =~ cnb\.cool$ ]]; then
250+
# cnb.cool
251+
# Replace URL path.
252+
# Ex. repos/example -> repos/example/-
253+
urlpath="$urlpath/-"
254+
if [[ $remote_ref = "master" ]]; then
255+
# repos/example/tree/master -> repos/example/-/tree/master
256+
urlpath="$urlpath$providerBranchRef"
257+
fi
249258
fi
250-
251259
openurl="$protocol://$domain/$urlpath"
252260

253261
if (( is_commit )); then

test/git-open.bats

+24
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,30 @@ setup() {
626626
assert_output "Issue feature does not supported on AWS Code Commit."
627627
}
628628

629+
##
630+
## cnb.cool
631+
##
632+
633+
@test "cnb: https url" {
634+
git remote set-url origin "https://cnb.cool/repos/repo"
635+
git checkout -B "master"
636+
run ../git-open
637+
assert_output "https://cnb.cool/repos/repo/-/tree/master"
638+
}
639+
640+
@test "cnb: branch " {
641+
git remote set-url origin "https://cnb.cool/repos/repo"
642+
git checkout -B "mybranch"
643+
run ../git-open
644+
assert_output "https://cnb.cool/repos/repo/-/tree/mybranch"
645+
}
646+
647+
@test "cnb: issue" {
648+
git remote set-url origin "https://cnb.cool/repos/repo"
649+
git checkout -B "issues/10"
650+
run ../git-open "--issue"
651+
assert_output "https://cnb.cool/repos/repo/-/issues/10"
652+
}
629653

630654
teardown() {
631655
cd ..

0 commit comments

Comments
 (0)