Convert bat to powershell: diffing
This commit is contained in:
parent
8811df27c9
commit
4339d74109
1 changed files with 6 additions and 9 deletions
|
|
@ -33,20 +33,17 @@ def comparefiles(importedjsonfile, currentjsonfile) {
|
|||
# jq -S sorts json output
|
||||
jq -S . "${importedjsonfile}" > temp1.txt
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
jq -S . "${importedjsonfile}" > temp2.txt
|
||||
jq -S . "${currentjsonfile}" > temp2.txt
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
|
||||
# echo Diffing sorted json files
|
||||
\$str1 = Get-Content "temp1.txt"
|
||||
\$str2 = Get-Content "temp2.txt"
|
||||
if (\$str1 -ne \$str2) {
|
||||
Write-Host "Difference between JSON files: "
|
||||
Compare-Object \$str1 \$str2
|
||||
exit 1
|
||||
}
|
||||
|
||||
diff.exe -c .\temp1.txt .\temp2.txt
|
||||
\$lec = \$lastexitcode
|
||||
|
||||
Remove-Item temp1.txt
|
||||
Remove-Item temp2.txt
|
||||
|
||||
if (\$lec -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue