Skip to content

Latest commit

 

History

History
82 lines (51 loc) · 3.06 KB

README.md

File metadata and controls

82 lines (51 loc) · 3.06 KB

Gendiff

Actions Status CitHub_CI CodeQL

Maintainability Test Coverage wemake-python-styleguide

Challenge | 100 Days of Code

Gendiff (GENerator of DIFFerences) - a program defining the difference between two data structures (JSON or YAML) and generating new structure containing differences details (including unchanged).

Features

  • Supported input formats: YAML, JSON
  • Report generation as plain text, structured text and JSON
  • Usage as CLI util or library function

Installation

Use the package manager pip to install gendiff.

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

Installation and usage example

asciicast

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            first file to compare
  second_file           second file to compare

optional arguments:
  -h, --help            show this help message and exit
  -f {json,plain,stylish}, --format {json,plain,stylish}
                        set output format (default: 'stylish')

Usage examples

JSON output (-f json)

asciicast

Structured output (-f stylish)

asciicast

Plain output (-f plain)

asciicast

Contributing

This is a learning project and the contribution is not accepted.

License

MIT License