- Supports input formats as JSON and YAML
- Output in three formats: plain, tree-like and JSON
- Use as CLI utility or library
Use the package manager pip to install gendiff.
pip install --user git+https://github.com/sgmdlt/python-project-lvl2.git
from gendiff import generate_diff
diff = generate_diff(file_path1, file_path2, style)
print(diff)
❯ gendiff -h
usage: gendiff [-h] [-f {json,plain,stylish}] first_file second_file
Generate difference of two JSON or YAML files.
positional arguments:
first_file path to first file
second_file path to second file
optional arguments:
-h, --help show this help message and exit
-f [stylish, plain, json], --format [stylish, plain, json]
set format of output (default: stylish)
As you can see, it's pretty straightforward
What about nested files?
'Plain style' output
Output is JSON