Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 2.29 KB

README.md

File metadata and controls

71 lines (47 loc) · 2.29 KB

Hexlet tests and linter status:

Actions Status Python CI Maintainability Test Coverage

Gendiff

a simple utility for comparing two files

  • Supports input formats as JSON and YAML
  • Output in three formats: plain, tree-like and JSON
  • Use as CLI utility or library

Installation

Use the package manager pip to install gendiff.

pip install --user git+https://github.com/sgmdlt/python-project-lvl2.git

Usage

As library function

from gendiff import generate_diff

diff = generate_diff(file_path1, file_path2, style)
print(diff)

As CLI util

❯ 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)

Usage examples

As you can see, it's pretty straightforward

asciicast


What about nested files?

asciicast


'Plain style' output

asciicast


Output is JSON

asciicast