Skip to content

Commit

Permalink
chore: Add repository type selection prompt in config_util.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yangbobo2021 committed May 22, 2024
1 parent e008f17 commit 5738242
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions merico/pr/config_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# 支持的类型有:github gitlab bitbucket bitbucket_server azure codecommit gerrit
def get_repo_type(url):
# 根据URL的特征判断仓库管理类型
support_repo_list = ["github", "gitlab", "bitbucket", "bitbucket_server", "azure", "codecommit", "gerrit"]
if "github.com" in url:
return "github"
elif "gitlab.com" in url or "gitlab" in url:
Expand All @@ -28,21 +29,14 @@ def get_repo_type(url):
return cache_repo_types[url]
else:
radio = Radio(
["github", "gitlab", "bitbucket", "bitbucket_server", "azure", "codecommit", "gerrit"],
support_repo_list,
title="Choose the type of repository:",
)
radio.render()
if radio.selection is None:
return ""

rtype = [
"github",
"gitlab",
"bitbucket",
"bitbucket_server",
"azure",
"codecommit",
"gerrit",
][radio.selection]
rtype = support_repo_list[radio.selection]
cache_repo_types[url] = rtype
return rtype

Expand Down

0 comments on commit 5738242

Please sign in to comment.