Improve comparing tips document (#1727)

This commit is contained in:
ryohma0510 2023-07-18 07:53:50 +09:00 committed by GitHub
parent 8986b92d05
commit 892308bf54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,7 +148,7 @@ yq -n '.someNew="content"' > newfile.yml
The best way to run a diff is to use `yq` to normalise the yaml files and then just use diff. Here is a simple example of using pretty print `-P` to normalise the styling and running diff:
```
diff <(yq -P 'sort_keys(..)' file1.yaml) <(yq -P 'sort_keys(..)' file2.yaml)
diff <(yq -P 'sort_keys(..)' -o=props file1.yaml) <(yq -P 'sort_keys(..)' -o=props file2.yaml)
```
This way you can use the full power of `diff` and normalise the yaml files as you like.