mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
6f8733eacd
commit
62a1bf96da
|
@ -72,6 +72,8 @@ const (
|
||||||
TagIcon properties.Property = "tag_icon"
|
TagIcon properties.Property = "tag_icon"
|
||||||
// MergeIcon shows before the merge context
|
// MergeIcon shows before the merge context
|
||||||
MergeIcon properties.Property = "merge_icon"
|
MergeIcon properties.Property = "merge_icon"
|
||||||
|
// UpstreamIcons allows to add custom upstream icons
|
||||||
|
UpstreamIcons properties.Property = "upstream_icons"
|
||||||
// GithubIcon shows√ when upstream is github
|
// GithubIcon shows√ when upstream is github
|
||||||
GithubIcon properties.Property = "github_icon"
|
GithubIcon properties.Property = "github_icon"
|
||||||
// BitbucketIcon shows when upstream is bitbucket
|
// BitbucketIcon shows when upstream is bitbucket
|
||||||
|
@ -337,6 +339,15 @@ func (g *Git) getUpstreamIcon() string {
|
||||||
}
|
}
|
||||||
g.RawUpstreamURL = g.getRemoteURL()
|
g.RawUpstreamURL = g.getRemoteURL()
|
||||||
g.UpstreamURL = cleanSSHURL(g.RawUpstreamURL)
|
g.UpstreamURL = cleanSSHURL(g.RawUpstreamURL)
|
||||||
|
|
||||||
|
// allow overrides first
|
||||||
|
custom := g.props.GetKeyValueMap(UpstreamIcons, map[string]string{})
|
||||||
|
for key, value := range custom {
|
||||||
|
if strings.Contains(g.UpstreamURL, key) {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defaults := map[string]struct {
|
defaults := map[string]struct {
|
||||||
Icon properties.Property
|
Icon properties.Property
|
||||||
Default string
|
Default string
|
||||||
|
|
|
@ -598,6 +598,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: "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"},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := &mock.MockedEnvironment{}
|
env := &mock.MockedEnvironment{}
|
||||||
|
@ -611,6 +612,9 @@ func TestGitUpstream(t *testing.T) {
|
||||||
BitbucketIcon: "BB",
|
BitbucketIcon: "BB",
|
||||||
AzureDevOpsIcon: "AD",
|
AzureDevOpsIcon: "AD",
|
||||||
GitIcon: "G",
|
GitIcon: "G",
|
||||||
|
UpstreamIcons: map[string]string{
|
||||||
|
"mycustom.server": "CU",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
g := &Git{
|
g := &Git{
|
||||||
scm: scm{
|
scm: scm{
|
||||||
|
|
|
@ -68,7 +68,7 @@ As doing multiple git calls can slow down the prompt experience, we do not fetch
|
||||||
You can set the following properties to `true` to enable fetching additional information (and populate the template).
|
You can set the following properties to `true` to enable fetching additional information (and populate the template).
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `fetch_status` | `boolean` | fetch the local changes - defaults to `false` |
|
| `fetch_status` | `boolean` | fetch the local changes - defaults to `false` |
|
||||||
| `fetch_upstream_icon` | `boolean` | fetch upstream icon - defaults to `false` |
|
| `fetch_upstream_icon` | `boolean` | fetch upstream icon - defaults to `false` |
|
||||||
| `fetch_bare_info` | `boolean` | fetch bare repo info - defaults to `false` |
|
| `fetch_bare_info` | `boolean` | fetch bare repo info - defaults to `false` |
|
||||||
|
@ -105,12 +105,13 @@ You can set the following properties to `true` to enable fetching additional inf
|
||||||
#### Upstream
|
#### Upstream
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ------------------- | -------- | ---------------------------------------------------------------------------------- |
|
| ------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `github_icon` | `string` | icon/text to display when the upstream is Github - defaults to `\uF408 ` |
|
| `github_icon` | `string` | icon/text to display when the upstream is Github - defaults to `\uF408 ` |
|
||||||
| `gitlab_icon` | `string` | icon/text to display when the upstream is Gitlab - defaults to `\uF296 ` |
|
| `gitlab_icon` | `string` | icon/text to display when the upstream is Gitlab - defaults to `\uF296 ` |
|
||||||
| `bitbucket_icon` | `string` | icon/text to display when the upstream is Bitbucket - defaults to `\uF171 ` |
|
| `bitbucket_icon` | `string` | icon/text to display when the upstream is Bitbucket - defaults to `\uF171 ` |
|
||||||
| `azure_devops_icon` | `string` | icon/text to display when the upstream is Azure DevOps - defaults to `\uFD03 ` |
|
| `azure_devops_icon` | `string` | icon/text to display when the upstream is Azure DevOps - defaults to `\uFD03 ` |
|
||||||
| `git_icon` | `string` | icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB ` |
|
| `git_icon` | `string` | icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB ` |
|
||||||
|
| `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 |
|
||||||
|
|
||||||
## Template ([info][templates])
|
## Template ([info][templates])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue