oh-my-posh/segment_envar.go

28 lines
460 B
Go
Raw Normal View History

2020-10-09 10:22:32 -07:00
package main
type envvar struct {
props *properties
env environmentInfo
content string
}
const (
// VarName name of the variable
2020-10-09 10:22:32 -07:00
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
}