init
This commit is contained in:
commit
8c388b1123
11 changed files with 347 additions and 0 deletions
65
README.md
Normal file
65
README.md
Normal 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).
|
Loading…
Add table
Add a link
Reference in a new issue