Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahume/go-yamedit
Modify human maintained YAML files
https://github.com/ahume/go-yamedit
go yaml yaml-parser
Last synced: 4 months ago
JSON representation
Modify human maintained YAML files
- Host: GitHub
- URL: https://github.com/ahume/go-yamedit
- Owner: ahume
- License: mit
- Created: 2016-12-16T16:19:20.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-28T16:26:27.000Z (over 4 years ago)
- Last Synced: 2024-06-20T05:01:35.989Z (8 months ago)
- Topics: go, yaml, yaml-parser
- Language: Go
- Size: 10.7 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yamedit
![CI](https://github.com/BrandwatchLtd/kuber-webhook/workflows/CI/badge.svg?branch=master&event=push)
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
```golang
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
```