Skip to content

Instantly share code, notes, and snippets.

@clementnuss
Last active June 2, 2023 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clementnuss/c3e021d5669d60c1a9ae44f2eeacce2b to your computer and use it in GitHub Desktop.
Save clementnuss/c3e021d5669d60c1a9ae44f2eeacce2b to your computer and use it in GitHub Desktop.
fish/bash function to prevent changing blank lines while using yq
#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" -
}
@bewuethr
Copy link

bewuethr commented Jun 2, 2023

Do also leave blanks alone, like when you have multiple blanks before a comment at the end of a line: diff -wB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment