Skip to content

Instantly share code, notes, and snippets.

@benibela
Last active August 30, 2021 13:16
Show Gist options
  • Save benibela/6a6ce144c8f1ecbc6ea86e55bb766a62 to your computer and use it in GitHub Desktop.
Save benibela/6a6ce144c8f1ecbc6ea86e55bb766a62 to your computer and use it in GitHub Desktop.
test if json in a diff has changed or not
(:input file:
+json := ...
-json := ...
+json2 := ...
-json2 := ...
:)
xidel patch.diff -e '
let $l := x:lines($raw)
let $del := $l[starts-with(., "-") and not(starts-with(., "---"))]
let $add := $l[starts-with(., "+") and not(starts-with(., "+++"))]
for $i in 1 to count($del)
return deep-equal(parse-json(substring-after($del[$i], ":=")), parse-json(substring-after($add[$i], ":=")))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment