mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-27 20:09:39 -08:00
feat(sapling): identify new repo without commits
This commit is contained in:
parent
a58aebcd5c
commit
2d0ee8c8ab
|
@ -52,6 +52,7 @@ type Sapling struct {
|
||||||
Author string
|
Author string
|
||||||
Bookmark string
|
Bookmark string
|
||||||
Description string
|
Description string
|
||||||
|
New bool
|
||||||
|
|
||||||
Working *SaplingStatus
|
Working *SaplingStatus
|
||||||
}
|
}
|
||||||
|
@ -129,6 +130,10 @@ func (sl *Sapling) setHeadContext() {
|
||||||
|
|
||||||
func (sl *Sapling) setCommitContext() {
|
func (sl *Sapling) setCommitContext() {
|
||||||
body := sl.getSaplingCommandOutput("log", "--limit", "1", "--template", SLCOMMITTEMPLATE)
|
body := sl.getSaplingCommandOutput("log", "--limit", "1", "--template", SLCOMMITTEMPLATE)
|
||||||
|
if len(body) == 0 {
|
||||||
|
sl.New = true
|
||||||
|
return
|
||||||
|
}
|
||||||
splitted := strings.Split(strings.TrimSpace(body), "\n")
|
splitted := strings.Split(strings.TrimSpace(body), "\n")
|
||||||
for _, line := range splitted {
|
for _, line := range splitted {
|
||||||
line = strings.TrimSpace(line)
|
line = strings.TrimSpace(line)
|
||||||
|
|
|
@ -10,19 +10,21 @@ Display [sapling][sapling] information when in a sapling repository.
|
||||||
|
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
||||||
import Config from '@site/src/components/Config.js';
|
import Config from "@site/src/components/Config.js";
|
||||||
|
|
||||||
<Config data={{
|
<Config
|
||||||
"type": "sapling",
|
data={{
|
||||||
"style": "powerline",
|
type: "sapling",
|
||||||
"powerline_symbol": "\uE0B0",
|
style: "powerline",
|
||||||
"foreground": "#193549",
|
powerline_symbol: "\uE0B0",
|
||||||
"background": "#4C9642",
|
foreground: "#193549",
|
||||||
"background_templates": ["{{ if .Bookmark }}#4C9642{{ end }}"],
|
background: "#4C9642",
|
||||||
"properties": {
|
background_templates: ["{{ if .Bookmark }}#4C9642{{ end }}"],
|
||||||
"fetch_status": true
|
properties: {
|
||||||
}
|
fetch_status: true,
|
||||||
}}/>
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
@ -56,6 +58,7 @@ import Config from '@site/src/components/Config.js';
|
||||||
| `.When` | `string` | the commit's relative time indication |
|
| `.When` | `string` | the commit's relative time indication |
|
||||||
| `.Bookmark` | `string` | the commit's bookmark (if any) |
|
| `.Bookmark` | `string` | the commit's bookmark (if any) |
|
||||||
| `.Dir` | `string` | the repository's root directory |
|
| `.Dir` | `string` | the repository's root directory |
|
||||||
|
| `.New` | `boolean` | true when there are no commits in the repo |
|
||||||
|
|
||||||
### SaplingStatus
|
### SaplingStatus
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue