feat(git): add icon for Codeberg upstream

This commit is contained in:
Arjan Schrijver 2024-06-03 10:15:33 +02:00 committed by Jan De Dobbeleer
parent 443fdb24a1
commit d20bf0f881
4 changed files with 12 additions and 0 deletions

View file

@ -101,6 +101,8 @@ const (
AzureDevOpsIcon properties.Property = "azure_devops_icon" AzureDevOpsIcon properties.Property = "azure_devops_icon"
// CodeCommit shows when upstream is aws codecommit // CodeCommit shows when upstream is aws codecommit
CodeCommit properties.Property = "codecommit_icon" CodeCommit properties.Property = "codecommit_icon"
// CodebergIcon shows when upstream is codeberg
CodebergIcon properties.Property = "codeberg_icon"
// GitlabIcon shows when upstream is gitlab // GitlabIcon shows when upstream is gitlab
GitlabIcon properties.Property = "gitlab_icon" GitlabIcon properties.Property = "gitlab_icon"
// GitIcon shows when the upstream can't be identified // GitIcon shows when the upstream can't be identified
@ -498,6 +500,7 @@ func (g *Git) getUpstreamIcon() string {
"dev.azure.com": {AzureDevOpsIcon, "\uEBE8 "}, "dev.azure.com": {AzureDevOpsIcon, "\uEBE8 "},
"visualstudio.com": {AzureDevOpsIcon, "\uEBE8 "}, "visualstudio.com": {AzureDevOpsIcon, "\uEBE8 "},
"codecommit": {CodeCommit, "\uF270 "}, "codecommit": {CodeCommit, "\uF270 "},
"codeberg": {CodebergIcon, "\uF330 "},
} }
for key, value := range defaults { for key, value := range defaults {
if strings.Contains(g.UpstreamURL, key) { if strings.Contains(g.UpstreamURL, key) {

View file

@ -672,6 +672,7 @@ func TestGitUpstream(t *testing.T) {
{Case: "Azure DevOps", Expected: "AD", Upstream: "dev.azure.com/test"}, {Case: "Azure DevOps", Expected: "AD", Upstream: "dev.azure.com/test"},
{Case: "Azure DevOps Dos", Expected: "AD", Upstream: "test.visualstudio.com"}, {Case: "Azure DevOps Dos", Expected: "AD", Upstream: "test.visualstudio.com"},
{Case: "CodeCommit", Expected: "AC", Upstream: "codecommit::eu-west-1://test-repository"}, {Case: "CodeCommit", Expected: "AC", Upstream: "codecommit::eu-west-1://test-repository"},
{Case: "Codeberg", Expected: "CB", Upstream: "codeberg.org:user/repo.git"},
{Case: "Gitstash", Expected: "G", Upstream: "gitstash.com/test"}, {Case: "Gitstash", Expected: "G", Upstream: "gitstash.com/test"},
{Case: "My custom server", Expected: "CU", Upstream: "mycustom.server/test"}, {Case: "My custom server", Expected: "CU", Upstream: "mycustom.server/test"},
} }
@ -687,6 +688,7 @@ func TestGitUpstream(t *testing.T) {
BitbucketIcon: "BB", BitbucketIcon: "BB",
AzureDevOpsIcon: "AD", AzureDevOpsIcon: "AD",
CodeCommit: "AC", CodeCommit: "AC",
CodebergIcon: "CB",
GitIcon: "G", GitIcon: "G",
UpstreamIcons: map[string]string{ UpstreamIcons: map[string]string{
"mycustom.server": "CU", "mycustom.server": "CU",

View file

@ -1328,6 +1328,12 @@
"description": "Icon/text to display when the upstream is CodeCommit", "description": "Icon/text to display when the upstream is CodeCommit",
"default": "\uF270" "default": "\uF270"
}, },
"codeberg_icon": {
"type": "string",
"title": "Codeberg Icon",
"description": "Icon/text to display when the upstream is Codeberg",
"default": "\uF330"
},
"git_icon": { "git_icon": {
"type": "string", "type": "string",
"title": "Git Icon", "title": "Git Icon",

View file

@ -116,6 +116,7 @@ You can set the following properties to `true` to enable fetching additional inf
| `bitbucket_icon` | `string` | `\uF171` | icon/text to display when the upstream is Bitbucket | | `bitbucket_icon` | `string` | `\uF171` | icon/text to display when the upstream is Bitbucket |
| `azure_devops_icon` | `string` | `\uEBE8` | icon/text to display when the upstream is Azure DevOps | | `azure_devops_icon` | `string` | `\uEBE8` | icon/text to display when the upstream is Azure DevOps |
| `codecommit_icon` | `string` | `\uF270` | icon/text to display when the upstream is AWS CodeCommit | | `codecommit_icon` | `string` | `\uF270` | icon/text to display when the upstream is AWS CodeCommit |
| `codeberg_icon` | `string` | `\uF330` | icon/text to display when the upstream is Codeberg |
| `git_icon` | `string` | `\uE5FB` | icon/text to display when the upstream is not known/mapped | | `git_icon` | `string` | `\uE5FB` | icon/text to display when the upstream is not known/mapped |
| `upstream_icons` | `map[string]string` | | a key, value map representing the remote URL (or a part of that URL) and icon to use in case the upstream URL contains the key. These get precedence over the standard icons | | `upstream_icons` | `map[string]string` | | a key, value map representing the remote URL (or a part of that URL) and icon to use in case the upstream URL contains the key. These get precedence over the standard icons |