Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileDiff

Compares two CSV or JSON datasets by a key field and reports what was added, removed, and changed.

Structure

  • src/FileDiff.Core: diff algorithm and CSV/JSON readers, no dependency on the CLI
  • src/FileDiff.Cli: thin command-line wrapper
  • tests/FileDiff.Core.Tests: xUnit tests for the diff logic

How it works

Both files are read into a common representation: a record is a key plus a set of field values, regardless of format. The old set is loaded into a dictionary by key. Each new record is looked up in it. No match means added. A match with different field values means changed. Everything left in the dictionary after that is removed.

Build and test

dotnet build
dotnet test

Usage

FileDiff.Cli <oldFile> <newFile> --key <keyField>

Example:

FileDiff.Cli old.csv new.csv --key Id

Format is picked by file extension (.csv or .json), so old and new files don't have to use the same format. Output lists added and removed record keys. For changed records it shows which fields differ and their old/new values. Unchanged records are not shown.

About

CLI tool that compares two CSV or JSON datasets by a key field and reports added, removed, and changed records. C# / .NET · xUnit

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages