Closed simonw closed 3 years ago
Annoyingly the --json
flag is already being used for "output as JSON".
I can use --format=json
instead (already has --format=csv
and --format=tsv
).
Had to add special treatment for nested lists and objects - they get serialized to a JSON string and compared that way.
Example output:
% csv-diff locations.json locations-updated.json --format json --key id
3 rows changed
id: rec00SICtL8KJiLim
Appointment scheduling instructions: "["https://www.riteaid.com/pharmacy/covid-qualifier"]" => "["https://www.riteaid.com/pharmacy/covid-qualifier", "blah 2"]"
id: rec05xrPZ4b7dCDns
Location Type: "Pharmacy" => "Pharmacy 2"
id: rec0IOCI2WsksvXef
Name: "WALMART PHARMACY 10-3477" => "WALMART PHARMACY 10-347"
I find myself wanting to generate commit messages for JSON files.
This can reuse almost all of the logic from
csv-diff
- so for the moment I'm going to add that ability here rather than spin up a brand new tool.A rename if this tool can come later!