AHBKM1024A-88 - Compare json files in windows
This commit is contained in:
parent
7fabd5e1c3
commit
bf53ffd821
1 changed files with 4 additions and 0 deletions
|
|
@ -11,23 +11,27 @@ def comparefiles(importedjsonfile, currentjsonfile) {
|
|||
else {
|
||||
// Jq and diffutils can be installed on windows with chocolatey
|
||||
bat """
|
||||
echo Checking utilities exist
|
||||
where jq
|
||||
if errorlevel 1 EXIT /b 1
|
||||
where diff
|
||||
if errorlevel 1 EXIT /b 1
|
||||
|
||||
echo Sorting json in files to compare
|
||||
# jq -S sorts json output
|
||||
jq -S . "${importedjsonfile}" > temp1.txt
|
||||
if errorlevel 1 EXIT /b 1
|
||||
jq -S . "${importedjsonfile}" > temp2.txt
|
||||
if errorlevel 1 EXIT /b 1
|
||||
|
||||
echo Diffing sorted json files
|
||||
diff -c temp1.txt temp2.txt
|
||||
set el=%errorlevel%
|
||||
|
||||
del temp1.txt
|
||||
del temp2.txt
|
||||
|
||||
echo Diffing result: %el%
|
||||
if el GEQ 1 EXIT /b 1
|
||||
"""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue