|
| 1 | +# CSV-DIFF |
| 2 | + |
| 3 | +**CSV-DIFF** is a powerful and flexible CLI tool written in Go for comparing two CSV files. It highlights added, |
| 4 | +deleted, updated, and reordered rows based on configurable composite keys. It’s useful for tracking changes in tabular |
| 5 | +data like exports from databases, spreadsheets, or APIs. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 📑 Table of Contents |
| 10 | + |
| 11 | +- [Features](#-features) |
| 12 | +- [Installation](#-installation) |
| 13 | +- [Usage](#-usage) |
| 14 | +- [Makefile](#-makefile) |
| 15 | +- [License](#-license) |
| 16 | +- [Contributing](#-contributing) |
| 17 | +- [Code of Conduct](#-code-of-conduct) |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## 📌 Features |
| 22 | + |
| 23 | +- Compare two CSV files and identify: |
| 24 | + - Added, deleted, updated, or reordered rows |
| 25 | +- Use composite keys to match rows across files |
| 26 | +- Output results in JSON or CSV |
| 27 | +- Filter output to focus on specific change types |
| 28 | +- Optionally include unchanged rows |
| 29 | +- Easy to use via CLI flags |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## 🛠️ Installation |
| 34 | + |
| 35 | +### Install via `go install` |
| 36 | + |
| 37 | +Make sure you have [Go](https://golang.org/dl/) installed. |
| 38 | + |
| 39 | +```bash |
| 40 | +go install github.com/manishjalui11/csv-diff@latest |
| 41 | +``` |
| 42 | + |
| 43 | +This will install csv-diff into your $GOPATH/bin. |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## 🚀 Usage |
| 48 | + |
| 49 | +```bash |
| 50 | +csv-diff [flags] <original.csv> <new.csv> |
| 51 | +``` |
| 52 | + |
| 53 | +### Example |
| 54 | + |
| 55 | +```bash |
| 56 | +csv-diff -k 0,1 -s json -o diff.json file_old.csv file_new.csv |
| 57 | +``` |
| 58 | + |
| 59 | +### CLI Flags |
| 60 | + |
| 61 | +| Flag | Short | Description | |
| 62 | +|---------------------|-------|-------------------------------------------------------------------------------| |
| 63 | +| --save | -s | Format to save output (json or csv) | |
| 64 | +| --output | -o | Filename to save changes | |
| 65 | +| --key | -k | Comma-separated list of column indexes to use as a composite key (default: 0) | |
| 66 | +| --show-changes | -c | Show detailed changes | |
| 67 | +| --include-unchanged | -z | Include unchanged rows in the output | |
| 68 | +| --filter-added | -a | Only show added rows | |
| 69 | +| --filter-deleted | -d | Only show deleted rows | |
| 70 | +| --filter-updated | -u | Only show updated rows | |
| 71 | +| --filter-reordered | -r | Only show reordered rows | |
| 72 | +| --help | -h | Show usage/help information | |
| 73 | +| --version | -v | Show app version | |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## 🧰 Makefile |
| 78 | +The project includes a Makefile to simplify common development tasks. |
| 79 | + |
| 80 | +Common Targets |
| 81 | +```bash |
| 82 | +make build # Build the csv-diff binary |
| 83 | +make test # Run tests |
| 84 | +make test-race # Run tests with race detection and coverage |
| 85 | +make run # Build and run csv-diff with sample files |
| 86 | +make clean # Remove built binaries |
| 87 | +make help # Show available targets |
| 88 | +``` |
| 89 | +You can always run make help to list all available targets. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## 📄 License |
| 94 | + |
| 95 | +This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## 🤝 Contributing |
| 100 | + |
| 101 | +We welcome contributions from the community! Whether it's bug fixes, new features, or improvements, your help is |
| 102 | +appreciated. |
| 103 | + |
| 104 | +To get started: |
| 105 | + |
| 106 | +1. **Fork the repository** and create your branch (`git checkout -b feature-branch`). |
| 107 | +2. **Make your changes** and test them thoroughly. |
| 108 | +3. **Commit your changes** with clear and concise commit messages. |
| 109 | +4. **Push to your fork** (`git push origin feature-branch`). |
| 110 | +5. **Open a Pull Request** describing your changes and why they're useful. |
| 111 | + |
| 112 | +If you encounter any issues or have ideas for new features, |
| 113 | +please [open an issue](https://github.com/manishjalui11/csv-diff/issues) or submit a feature request. |
| 114 | + |
| 115 | +By contributing, you agree to follow the project's coding guidelines and adhere to our code of conduct. |
| 116 | + |
| 117 | +Thank you for being awesome and helping improve the project! 🙌 |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## 📜 Code of Conduct |
| 122 | + |
| 123 | +We are committed to creating a welcoming environment for all contributors. Please review and follow |
| 124 | +our [Code of Conduct](./CODE_OF_CONDUCT.md). |
0 commit comments