Skip to content

Use "mikefarah/yq" library to manipulate YAML stored as string type variable

License

Notifications You must be signed in to change notification settings

kamolhasan/yq-for-strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yq-for-strings

Use "mikefarah/yq" library to manipulate YAML stored as string type variable

Examples:

func main() {
	y1 := `
ar:
# list of ar
- "aaa"
- "bbb"
- "ccc"
a: "aaaa"
b:
  c:
    d: "dddd"
`

	y2 := `
a: "aaaa"
ar:
# value ddd
- "ddd"
b:
  c:
    e: "some"
    d:
      f: "FFFF"
`
	output, err := yqstrings.Merge(yqlib.AppendArrayMergeStrategy, yqlib.AppendCommentsMergeStrategy, true, y1, y2)
	if err != nil {
		panic(err)
	}

	fmt.Println(output)
}

Output:

ar:
    # list of ar
    - "aaa"
    - "bbb"
    - "ccc"
    # value ddd
    - "ddd"
a: "aaaa"
b:
    c:
        d:
            f: "FFFF"
        e: "some"

About

Use "mikefarah/yq" library to manipulate YAML stored as string type variable

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages