mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 02:03:24 +08:00
wip
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package yqlib
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"os"
|
||||
|
||||
yaml "gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// type EnvOpPreferences struct {
|
||||
// StringValue bool
|
||||
// }
|
||||
|
||||
func EnvOperator(d *dataTreeNavigator, matchMap *list.List, pathNode *PathTreeNode) (*list.List, error) {
|
||||
envName := pathNode.Operation.CandidateNode.Node.Value
|
||||
log.Debug("EnvOperator, env name:", envName)
|
||||
|
||||
rawValue := os.Getenv(envName)
|
||||
|
||||
target := &CandidateNode{
|
||||
Path: make([]interface{}, 0),
|
||||
Document: 0,
|
||||
Filename: "",
|
||||
Node: &yaml.Node{
|
||||
Kind: yaml.ScalarNode,
|
||||
Tag: "!!str",
|
||||
Value: rawValue,
|
||||
},
|
||||
}
|
||||
|
||||
return nodeToMap(target), nil
|
||||
}
|
||||
Reference in New Issue
Block a user