Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/semihbkgr/yamldiff
compare structural differences between two yaml files
https://github.com/semihbkgr/yamldiff
command-line diff tools utility yaml
Last synced: about 1 month ago
JSON representation
compare structural differences between two yaml files
- Host: GitHub
- URL: https://github.com/semihbkgr/yamldiff
- Owner: semihbkgr
- License: mit
- Created: 2023-12-08T20:29:41.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-05T11:07:34.000Z (2 months ago)
- Last Synced: 2024-11-16T14:35:47.756Z (about 2 months ago)
- Topics: command-line, diff, tools, utility, yaml
- Language: Go
- Homepage:
- Size: 548 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yamldiff
yamldiff is a utility tool for performing structural comparisons on YAML files, helping you easily identify and understand differences between them.
It focuses on highlighting structural variations between two YAML files.
![example](images/example.png)
## Installation
```bash
$ go install github.com/semihbkgr/yamldiff@latest
```Run with `help` flag to display a list of available options
```bash
$ yamldiff --help
structural comparison on two yaml filesUsage:
yamldiff [flags]Flags:
-c, --comment Include comments in the output when available.
-e, --exit Exit with a non-zero status code if differences are found between yaml files.
-h, --help help for yamldiff
-m, --metadata Include additional metadata in the output (not applicable with the silent flag).
-p, --plain Output without any color formatting.
-s, --silent Suppress output of values, showing only differences.
-u, --unordered Ignore the order of items in arrays during comparison.
-v, --version version for yamldiff
```## Example
```bash
$ yamldiff --metadata examples/pod-v1.yaml examples/pod-v2.yaml
```![example-metadata](images/example-metadata.png)
It can also be imported as a library in Go.
```go
func main() {
left := []byte(`
name: Alice
city: New York
items:
- one
- two
`)right := []byte(`
name: Bob
value: 990
items:
- one
- three
`)diffs, err := compare.Compare(left, right, false, compare.DefaultDiffOptions)
if err != nil {
panic(err)
}output := diffs.Format(compare.FormatOptions{
Plain: true,
Silent: false,
Metadata: false,
})
fmt.Println(output)
}
``````out
~ name: Alice -> Bob
- city: New York
+ value: 990
~ items[1]: two -> three
```