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{
|
||||||
|
|
|
@ -67,14 +67,14 @@ You can then use the `POSH_GIT_STRING` environment variable in a [text segment][
|
||||||
As doing multiple git calls can slow down the prompt experience, we do not fetch information by default.
|
As doing multiple git calls can slow down the prompt experience, we do not fetch information by default.
|
||||||
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` |
|
||||||
| `untracked_modes` | `map[string]string` | map of repo's where to override the default [untracked files mode][untracked]:<ul><li>`no`</li><li>`normal`</li><li>`all`</li></ul>For example `"untracked_modes": { "/Users/me/repos/repo1": "no" }` - defaults to `normal` for all repo's. If you want to override for all repo's, use `*` to set the mode instead of the repo path |
|
| `untracked_modes` | `map[string]string` | map of repo's where to override the default [untracked files mode][untracked]:<ul><li>`no`</li><li>`normal`</li><li>`all`</li></ul>For example `"untracked_modes": { "/Users/me/repos/repo1": "no" }` - defaults to `normal` for all repo's. If you want to override for all repo's, use `*` to set the mode instead of the repo path |
|
||||||
| `ignore_submodules` | `map[string]string` | map of repo's where to change the [--ignore-submodules][submodules] flag (`none`, `untracked`, `dirty` or `all`). For example `"ignore_submodules": { "/Users/me/repos/repo1": "all" }`. If you want to override for all repo's, use `*` to set the mode instead of the repo path |
|
| `ignore_submodules` | `map[string]string` | map of repo's where to change the [--ignore-submodules][submodules] flag (`none`, `untracked`, `dirty` or `all`). For example `"ignore_submodules": { "/Users/me/repos/repo1": "all" }`. If you want to override for all repo's, use `*` to set the mode instead of the repo path |
|
||||||
| `native_fallback` | `boolean` | when set to `true` and `git.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native git executable to fetch data. Not all information can be displayed in this case. Defaults to `false` |
|
| `native_fallback` | `boolean` | when set to `true` and `git.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native git executable to fetch data. Not all information can be displayed in this case. Defaults to `false` |
|
||||||
|
|
||||||
### Icons
|
### Icons
|
||||||
|
|
||||||
|
@ -104,13 +104,14 @@ 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