diff --git a/docs/docs/segment-environment.md b/docs/docs/segment-environment.md index 8ddf5c8b..1012c851 100644 --- a/docs/docs/segment-environment.md +++ b/docs/docs/segment-environment.md @@ -50,3 +50,7 @@ The segment will show when the value of the environment variable isn't empty. ``` - var_name: `string` - the name of the environment variable + +## Template Properties + +- `.Value`: `string` - the value of the environment variable diff --git a/src/segment_envar.go b/src/segment_envar.go index d403ab26..b5bc65ae 100644 --- a/src/segment_envar.go +++ b/src/segment_envar.go @@ -1,9 +1,9 @@ package main type envvar struct { - props *properties - env environmentInfo - content string + props *properties + env environmentInfo + Value string } const ( @@ -13,12 +13,12 @@ const ( func (e *envvar) enabled() bool { name := e.props.getString(VarName, "") - e.content = e.env.getenv(name) - return e.content != "" + e.Value = e.env.getenv(name) + return e.Value != "" } func (e *envvar) string() string { - return e.content + return e.Value } func (e *envvar) init(props *properties, env environmentInfo) { diff --git a/themes/schema.json b/themes/schema.json index 1bf448f1..504b884f 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -447,6 +447,9 @@ "properties": { "properties": { "properties": { + "template": { + "$ref": "#/definitions/template" + }, "var_name": { "type": "string", "title": "Variable Name",