- Supports formats: '.json' and '.yaml'/'.yml';
- Supports two native ouput formats: Plain, Stylish (default);
- Has special JSON ouput.
$ python3 -m pip install --user hexlet-code
$ gendiff filepath1 filepath2
from gendiff import generate_diff
diff = generate_diff(file_path1, file_path2)
print(diff)
$ cat file1 file2
{
"unmodified": "health",
"removed": "time",
"updated": "1000$"
}
{
"unmodified": "health",
"added": "knowledge",
"updated": "10000$"
}
$ gendiff file1 file2
{
+ added: knowledge
- removed: time
unmodified: health
- updated: 1000$
+ updated: 10000$
}
$ gendiff file1 file2 -f plain
Property 'added' was added with value: 'knowledge'
Property 'removed' was removed
Property 'updated' was updated. From '1000$' to '10000$'