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