Skip to content

mnogom/python-project-lvl2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Difference Generator


Hexlet tests and linter status:

python-ci hexlet-check Maintainability Test Coverage


Installation

pip3 install --upgrade git+https://github.com/mnogom/python-project-lvl2.git

Usage

  1. From command line
usage: gendiff [-h] [-f FORMAT] first_file second_file

Generate diff

positional arguments:
  first_file
  second_file

optional arguments:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        set format of output
  1. From python
import gendiff

style = "plain"  # ["stylish (default)" | "plain" | "json"]
output = gendiff.generate_diff("path/to/file1", "path/to/file2", style)

Features

  1. Works with JSON and YAML format
  2. Works with Plain and Recursive file structures
  3. Output in Stylish, Plain and JSON formats

See examples below


Examples

Plain JSON @ Stylish format

asciicast

Plain YAML @ Stylish format

asciicast

Recursive JSON @ Stylish format

asciicast

Recursive JSON @ Plain format

asciicast

Recursive JSON @ JSON format

asciicast