mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-13 20:27:28 -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
|
||||
WSL bool
|
||||
PromptCount int
|
||||
SHLVL int
|
||||
Segments SegmentsCache
|
||||
|
||||
sync.RWMutex
|
||||
|
@ -824,6 +825,11 @@ func (env *Shell) TemplateCache() *TemplateCache {
|
|||
tmplCache.OS = env.Platform()
|
||||
}
|
||||
|
||||
val := env.Getenv("SHLVL")
|
||||
if shlvl, err := strconv.Atoi(val); err == nil {
|
||||
tmplCache.SHLVL = shlvl
|
||||
}
|
||||
|
||||
env.tmplCache = tmplCache
|
||||
return tmplCache
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ offers a few standard properties to work with.
|
|||
| `.Folder` | `string` | the current working folder |
|
||||
| `.Shell` | `string` | the current shell name |
|
||||
| `.ShellVersion` | `string` | the current shell version |
|
||||
| `.SHLVL` | `int` | the current shell level |
|
||||
| `.UserName` | `string` | the current user name |
|
||||
| `.HostName` | `string` | the host name |
|
||||
| `.Code` | `int` | the last exit code |
|
||||
|
|
Loading…
Reference in a new issue