mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-21 02:55:37 -08:00
feat: show no commits context
This commit is contained in:
parent
8c68b89790
commit
11350c7347
|
@ -12,6 +12,7 @@ Local changes can also shown by default using the following syntax for both the
|
||||||
- `+` added
|
- `+` added
|
||||||
- `~` modified
|
- `~` modified
|
||||||
- `-` deleted
|
- `-` deleted
|
||||||
|
- `?` untracked
|
||||||
|
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ Local changes can also shown by default using the following syntax for both the
|
||||||
- rebase_icon: `string` - icon/text to display before the context when in a rebase - defaults to `\uE728 `
|
- rebase_icon: `string` - icon/text to display before the context when in a rebase - defaults to `\uE728 `
|
||||||
- cherry_pick_icon: `string` - icon/text to display before the context when doing a cherry-pick - defaults to `\uE29B `
|
- cherry_pick_icon: `string` - icon/text to display before the context when doing a cherry-pick - defaults to `\uE29B `
|
||||||
- merge_icon: `string` icon/text to display before the merge context - defaults to `\uE727 `
|
- merge_icon: `string` icon/text to display before the merge context - defaults to `\uE727 `
|
||||||
|
- no_commits_icon: `string` icon/text to display when there are no commits in the repo - defaults to `\uF594 `
|
||||||
|
|
||||||
### Upstream context
|
### Upstream context
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,8 @@ const (
|
||||||
CherryPickIcon Property = "cherry_pick_icon"
|
CherryPickIcon Property = "cherry_pick_icon"
|
||||||
// CommitIcon shows before the detached context
|
// CommitIcon shows before the detached context
|
||||||
CommitIcon Property = "commit_icon"
|
CommitIcon Property = "commit_icon"
|
||||||
|
// NoCommitsIcon shows when there are no commits in the repo yet
|
||||||
|
NoCommitsIcon Property = "no_commits_icon"
|
||||||
// TagIcon shows before the tag context
|
// TagIcon shows before the tag context
|
||||||
TagIcon Property = "tag_icon"
|
TagIcon Property = "tag_icon"
|
||||||
// DisplayStashCount show stash count or not
|
// DisplayStashCount show stash count or not
|
||||||
|
@ -309,6 +311,9 @@ func (g *git) getPrettyHEADName() string {
|
||||||
}
|
}
|
||||||
// fallback to commit
|
// fallback to commit
|
||||||
ref = g.getGitCommandOutput("rev-parse", "--short", "HEAD")
|
ref = g.getGitCommandOutput("rev-parse", "--short", "HEAD")
|
||||||
|
if ref == "" {
|
||||||
|
return g.props.getString(NoCommitsIcon, "\uF594 ")
|
||||||
|
}
|
||||||
return fmt.Sprintf("%s%s", g.props.getString(CommitIcon, "\uF417"), ref)
|
return fmt.Sprintf("%s%s", g.props.getString(CommitIcon, "\uF417"), ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue