2021-03-27 09:04:09 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
type poshgit struct {
|
2021-11-26 01:37:33 -08:00
|
|
|
props properties
|
2021-03-27 09:04:09 -07:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-11-26 01:37:33 -08:00
|
|
|
func (p *poshgit) init(props properties, env environmentInfo) {
|
2021-03-27 09:04:09 -07:00
|
|
|
p.props = props
|
|
|
|
p.env = env
|
|
|
|
}
|