mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-13 04:07:25 -08:00
feat(env): add template properties
This commit is contained in:
parent
c1bc4404e0
commit
2040771190
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -447,6 +447,9 @@
|
|||
"properties": {
|
||||
"properties": {
|
||||
"properties": {
|
||||
"template": {
|
||||
"$ref": "#/definitions/template"
|
||||
},
|
||||
"var_name": {
|
||||
"type": "string",
|
||||
"title": "Variable Name",
|
||||
|
|
Loading…
Reference in a new issue