项目作者: mnogom

项目描述 :
Education project
高级语言: Python
项目地址: git://github.com/mnogom/python-project-lvl2.git
创建时间: 2021-01-26T10:43:48Z
项目社区:https://github.com/mnogom/python-project-lvl2

开源协议:

下载


Difference Generator


Hexlet tests and linter status:

python-ci
hexlet-check
Maintainability
Test Coverage


Installation

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

Usage

  1. From command line
    ```commandline
    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. 2. From python
  2. ```python
  3. import gendiff
  4. style = "plain" # ["stylish (default)" | "plain" | "json"]
  5. 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