mirror of
https://github.com/mr0xb/scripts.git
synced 2026-08-27 19:34:57 -04:00
10 lines
501 B
Shell
Executable file
10 lines
501 B
Shell
Executable file
#!/usr/bin/env bash
|
|
|
|
# This script reliably compares the differences between two YAML files
|
|
# even with differeing nested values (useful for Helm values files
|
|
# comparisons and more). Note that the resulting diff CANNOT be reliably
|
|
# used as a patch against the YAML file since the comments are stripped
|
|
# during the comparison.
|
|
|
|
[[ -z $(command -v yq) ]] && echo "missing yq command" && exit 1
|
|
exec diff <(yq 'sort_keys(..) | ... comments=""' -P "$1") <(yq 'sort_keys(..) | ... comments=""' -P "$2")
|