Skip to content

Instantly share code, notes, and snippets.

@C4K3
Created May 4, 2023 00:22
Show Gist options
  • Save C4K3/98a6dd80fbfa4704563da73d460cfb54 to your computer and use it in GitHub Desktop.
Save C4K3/98a6dd80fbfa4704563da73d460cfb54 to your computer and use it in GitHub Desktop.
# Merges the two input files. Execute as
# jq -s -f statsmerge.jq file1 file2
# Numeric values with key beginning with "minecraft:" are added together.
# For all other values the value in b takes precedence
.[0] as $file1 | .[1] as $file2 |
$file1 + $file2 |
reduce paths(numbers) as $path
(
.;
if ($path | last | startswith("minecraft:")) then
setpath($path; getpath($path) + ($file2 | getpath($path)))
else
.
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment