This commit is contained in:
Alexander Zhirov 2025-09-01 03:21:54 +03:00
commit 8c388b1123
Signed by: alexander
GPG key ID: C8D8BE544A27C511
11 changed files with 347 additions and 0 deletions

65
README.md Normal file
View file

@ -0,0 +1,65 @@
# Simply Diff
A minimal D wrapper over [xdiff.d](https://git.zhirov.kz/dlang/xdiff) for computing file differences and generating patches.
## Features
* Create in-memory files (`MMFile`) from strings, string arrays, or raw bytes.
* Compute diffs between two in-memory files.
* Collect results as `MMBlocks`, convertible to a string or byte slice.
## Installation
Add to `dub.json`:
```json
{
"dependencies": {
"sdiff": "~>0.1.0"
}
}
```
Or
```json
{
"dependencies": {
"sdiff": {
"repository": "git+https://git.zhirov.kz/dlang/sdiff.git",
"version": "<hash from git>"
}
}
}
```
Run `dub build`.
## Example
```d
import sdiff;
import std.stdio : writeln;
void main()
{
auto a = new MMFile("hello world\n");
auto b = new MMFile("hello world!\n");
auto patch = a.diff(b);
writeln(patch);
}
```
Output:
```diff
@@ -1,1 +1,1 @@
-hello world
+hello world!
```
## License
Boost Software License 1.0. See [LICENSE](LICENSE).