oh-my-posh/segment_envar.go
2020-10-09 20:54:41 +02:00

28 lines
459 B
Go

package main
type envvar struct {
props *properties
env environmentInfo
content string
}
const (
//VarName name of the variable
VarName Property = "var_name"
)
func (e *envvar) enabled() bool {
name := e.props.getString(VarName, "")
e.content = e.env.getenv(name)
return e.content != ""
}
func (e *envvar) string() string {
return e.content
}
func (e *envvar) init(props *properties, env environmentInfo) {
e.props = props
e.env = env
}