mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-05 16:27:26 -08:00
29 lines
465 B
Go
29 lines
465 B
Go
|
package main
|
||
|
|
||
|
import "strings"
|
||
|
|
||
|
type poshgit struct {
|
||
|
props *properties
|
||
|
env environmentInfo
|
||
|
gitStatus string
|
||
|
}
|
||
|
|
||
|
const (
|
||
|
poshGitEnv = "POSH_GIT_STATUS"
|
||
|
)
|
||
|
|
||
|
func (p *poshgit) enabled() bool {
|
||
|
status := p.env.getenv(poshGitEnv)
|
||
|
p.gitStatus = strings.TrimSpace(status)
|
||
|
return p.gitStatus != ""
|
||
|
}
|
||
|
|
||
|
func (p *poshgit) string() string {
|
||
|
return p.gitStatus
|
||
|
}
|
||
|
|
||
|
func (p *poshgit) init(props *properties, env environmentInfo) {
|
||
|
p.props = props
|
||
|
p.env = env
|
||
|
}
|