ahume / go-yamedit

Modify human maintained YAML files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yamedit

CI

Allows yaml files that are typically edited by humans to be updated without losing any formatting or comments.

It is not a fully-fledged YAML parser/writer, and only deals with updating values for existing fields in a YAML file. It cannot add new fields or new sub-trees to the data structure.

Example

yaml := []byte(`---
apiVersion: v1
kind: Namespace
metadata:
  name: platform
  labels:
    team: pricing`)

path := "/metadata/labels/team"


updated, err := yamedit.Edit(yaml, path, "checkout")
if err != nil {
  log.Fatal(err)
}

fmt.Println(updated)
// apiVersion: v1
// kind: Namespace
// metadata:
//  name: platform
//  labels:
//    team: checkout

About

Modify human maintained YAML files

License:MIT License


Languages

Language:Go 100.0%