We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7455e3a commit a7994e8Copy full SHA for a7994e8
bin/sort
@@ -4,9 +4,14 @@
4
yq '.zones | keys | .[]' config/production.yaml | while read -r zone; do
5
# For each file...
6
FILENAME="$zone"yaml
7
- echo Sorting $FILENAME
+ echo -e "\nSorting $FILENAME"
8
9
- # Sort the keys in the file
+ # Print a diff (if changes are made)
10
+ yq -MP 'sort_keys(.)' $FILENAME >$FILENAME.tmp
11
+ diff -u $FILENAME $FILENAME.tmp | diffstat -q
12
+ rm $FILENAME.tmp
13
+
14
+ # Apply the changes
15
yq -iMP 'sort_keys(.)' $FILENAME
16
# - i: in-place
17
# - M: no color
0 commit comments