mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
feat(template): add parsed SHLVL
This commit is contained in:
parent
3f4f42cc09
commit
8fe6dd2dcf
|
@ -189,6 +189,7 @@ type TemplateCache struct {
|
||||||
OS string
|
OS string
|
||||||
WSL bool
|
WSL bool
|
||||||
PromptCount int
|
PromptCount int
|
||||||
|
SHLVL int
|
||||||
Segments SegmentsCache
|
Segments SegmentsCache
|
||||||
|
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
|
@ -824,6 +825,11 @@ func (env *Shell) TemplateCache() *TemplateCache {
|
||||||
tmplCache.OS = env.Platform()
|
tmplCache.OS = env.Platform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val := env.Getenv("SHLVL")
|
||||||
|
if shlvl, err := strconv.Atoi(val); err == nil {
|
||||||
|
tmplCache.SHLVL = shlvl
|
||||||
|
}
|
||||||
|
|
||||||
env.tmplCache = tmplCache
|
env.tmplCache = tmplCache
|
||||||
return tmplCache
|
return tmplCache
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ offers a few standard properties to work with.
|
||||||
| `.Folder` | `string` | the current working folder |
|
| `.Folder` | `string` | the current working folder |
|
||||||
| `.Shell` | `string` | the current shell name |
|
| `.Shell` | `string` | the current shell name |
|
||||||
| `.ShellVersion` | `string` | the current shell version |
|
| `.ShellVersion` | `string` | the current shell version |
|
||||||
|
| `.SHLVL` | `int` | the current shell level |
|
||||||
| `.UserName` | `string` | the current user name |
|
| `.UserName` | `string` | the current user name |
|
||||||
| `.HostName` | `string` | the host name |
|
| `.HostName` | `string` | the host name |
|
||||||
| `.Code` | `int` | the last exit code |
|
| `.Code` | `int` | the last exit code |
|
||||||
|
|
Loading…
Reference in a new issue