|
1 | | -# CSV-DIFF |
| 1 | +# CSV Diff Tool 🛠️ |
2 | 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. |
| 3 | +  |
6 | 4 |
|
7 | | ---- |
| 5 | +Welcome to the **CSV Diff Tool** repository! This project offers a fast and flexible command-line tool for comparing CSV files using composite keys. It generates clean, structured diffs, making it easier for you to identify changes between datasets. |
8 | 6 |
|
9 | | -## 📑 Table of Contents |
| 7 | +## Table of Contents |
10 | 8 |
|
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) |
| 9 | +- [Features](#features) |
| 10 | +- [Installation](#installation) |
| 11 | +- [Usage](#usage) |
| 12 | +- [Command-Line Options](#command-line-options) |
| 13 | +- [Examples](#examples) |
| 14 | +- [Contributing](#contributing) |
| 15 | +- [License](#license) |
| 16 | +- [Contact](#contact) |
18 | 17 |
|
19 | | ---- |
| 18 | +## Features |
20 | 19 |
|
21 | | -## 📌 Features |
| 20 | +- **Fast Comparison**: Quickly compare large CSV files. |
| 21 | +- **Composite Key Support**: Use multiple columns as keys for accurate comparisons. |
| 22 | +- **Structured Output**: Get clean diffs that are easy to read. |
| 23 | +- **Cross-Platform**: Works on Linux, macOS, and Windows. |
| 24 | +- **Open Source**: Free to use and modify under the MIT License. |
22 | 25 |
|
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 |
| 26 | +## Installation |
30 | 27 |
|
31 | | ---- |
| 28 | +To get started, download the latest release of the CSV Diff Tool from our [Releases page](https://github.com/NaumanAkramIT/csv-diff/releases). Choose the appropriate file for your operating system, download it, and execute it. |
| 29 | + |
| 30 | +### For Linux and macOS |
| 31 | + |
| 32 | +1. Open your terminal. |
| 33 | +2. Download the binary file using `curl` or `wget`: |
| 34 | + ```bash |
| 35 | + curl -LO https://github.com/NaumanAkramIT/csv-diff/releases/download/vX.X.X/csv-diff-linux-amd64 |
| 36 | + chmod +x csv-diff-linux-amd64 |
| 37 | + sudo mv csv-diff-linux-amd64 /usr/local/bin/csv-diff |
| 38 | + ``` |
32 | 39 |
|
33 | | -## 🛠️ Installation |
| 40 | +### For Windows |
34 | 41 |
|
35 | | -### Install via `go install` |
| 42 | +1. Download the `.exe` file from the [Releases page](https://github.com/NaumanAkramIT/csv-diff/releases). |
| 43 | +2. Place the executable in a directory included in your system's PATH. |
36 | 44 |
|
37 | | -Make sure you have [Go](https://golang.org/dl/) installed. |
| 45 | +## Usage |
| 46 | + |
| 47 | +Once installed, you can start using the CSV Diff Tool from your command line. The basic syntax is: |
38 | 48 |
|
39 | 49 | ```bash |
40 | | -go install github.com/manishjalui11/csv-diff@latest |
| 50 | +csv-diff [options] <file1.csv> <file2.csv> |
41 | 51 | ``` |
42 | 52 |
|
43 | | -This will install csv-diff into your $GOPATH/bin. |
| 53 | +This command will compare `file1.csv` and `file2.csv` and output the differences. |
44 | 54 |
|
45 | | ---- |
| 55 | +## Command-Line Options |
46 | 56 |
|
47 | | -## 🚀 Usage |
| 57 | +| Option | Description | |
| 58 | +|----------------|------------------------------------------| |
| 59 | +| `-k, --keys` | Specify composite keys for comparison. | |
| 60 | +| `-o, --output` | Specify output format (e.g., JSON, CSV).| |
| 61 | +| `-h, --help` | Display help information. | |
| 62 | +| `-v, --version`| Show the version of the tool. | |
48 | 63 |
|
49 | | -```bash |
50 | | -csv-diff [flags] <original.csv> <new.csv> |
51 | | -``` |
| 64 | +## Examples |
52 | 65 |
|
53 | | -### Example |
| 66 | +### Basic Comparison |
| 67 | + |
| 68 | +To compare two CSV files without any options: |
54 | 69 |
|
55 | 70 | ```bash |
56 | | -csv-diff -k 0,1 -s json -o diff.json file_old.csv file_new.csv |
| 71 | +csv-diff file1.csv file2.csv |
57 | 72 | ``` |
58 | 73 |
|
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 | | ---- |
| 74 | +### Using Composite Keys |
76 | 75 |
|
77 | | -## 🧰 Makefile |
78 | | -The project includes a Makefile to simplify common development tasks. |
| 76 | +If you want to compare based on specific columns, use the `-k` option: |
79 | 77 |
|
80 | | -Common Targets |
81 | 78 | ```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 |
| 79 | +csv-diff -k column1,column2 file1.csv file2.csv |
88 | 80 | ``` |
89 | | -You can always run make help to list all available targets. |
90 | 81 |
|
91 | | ---- |
| 82 | +### Outputting in JSON Format |
92 | 83 |
|
93 | | -## 📄 License |
| 84 | +To get the differences in JSON format, use the `-o` option: |
94 | 85 |
|
95 | | -This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. |
| 86 | +```bash |
| 87 | +csv-diff -o json file1.csv file2.csv |
| 88 | +``` |
96 | 89 |
|
97 | | ---- |
| 90 | +## Contributing |
98 | 91 |
|
99 | | -## 🤝 Contributing |
| 92 | +We welcome contributions! If you have suggestions for improvements or new features, please open an issue or submit a pull request. Make sure to follow our code of conduct and contribution guidelines. |
100 | 93 |
|
101 | | -We welcome contributions from the community! Whether it's bug fixes, new features, or improvements, your help is |
102 | | -appreciated. |
| 94 | +1. Fork the repository. |
| 95 | +2. Create your feature branch: `git checkout -b feature/MyFeature` |
| 96 | +3. Commit your changes: `git commit -m 'Add some feature'` |
| 97 | +4. Push to the branch: `git push origin feature/MyFeature` |
| 98 | +5. Open a pull request. |
103 | 99 |
|
104 | | -To get started: |
| 100 | +## License |
105 | 101 |
|
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. |
| 102 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
111 | 103 |
|
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. |
| 104 | +## Contact |
114 | 105 |
|
115 | | -By contributing, you agree to follow the project's coding guidelines and adhere to our code of conduct. |
| 106 | +For questions or feedback, please reach out to the maintainer: |
116 | 107 |
|
117 | | -Thank you for being awesome and helping improve the project! 🙌 |
| 108 | +- **Nauman Akram**: [GitHub Profile](https://github.com/NaumanAkramIT) |
118 | 109 |
|
119 | 110 | --- |
120 | 111 |
|
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). |
| 112 | +Thank you for checking out the CSV Diff Tool! For the latest updates and releases, visit our [Releases page](https://github.com/NaumanAkramIT/csv-diff/releases). Happy comparing! |
0 commit comments