ajout jsondiff

This commit is contained in:
Jephté Clain 2025-06-19 11:24:18 +04:00
parent 8b7b318acd
commit 70c82ae504

24
bin/jsondiff Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname -- "$0")/../load.sh" || exit 1
args=(
"comparer deux fichiers JSON"
"first.json second.json"
)
parse_args "$@"; set -- "${args[@]}"
first="$1"; shift
[ -n "$first" ] || die "vous devez spécifier le premier fichier"
second="$1"; shift
[ -n "$second" ] || die "vous devez spécifier le deuxième fichier"
if [ $# -gt 0 ]; then
options=("$@")
else
options=(-u)
fi
diff "${options[@]}" \
<(jq . <"$first") \
<(jq . <"$second")