mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
28 lines
459 B
Go
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
|
||
|
}
|