Last active
June 2, 2023 23:09
-
-
Save clementnuss/c3e021d5669d60c1a9ae44f2eeacce2b to your computer and use it in GitHub Desktop.
fish/bash function to prevent changing blank lines while using yq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fish | |
function yqblank; | |
yq eval "$argv[1]" "$argv[2]" | diff -B "$argv[2]" - | patch "$argv[2]" -o - | |
end | |
#bash | |
yqblank() { | |
yq "$1" "$2" | diff -B "$2" - | patch "$2" - | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do also leave blanks alone, like when you have multiple blanks before a comment at the end of a line:
diff -wB
.