Skip to content

zluuba/difference-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Difference generator

Actions Status Python CI Maintainability Test Coverage

Difference generator compares two files and outputs the result in three different style: stylish, plain and json.
Used with the terminal.
Json and yaml formats are supported.

Requirements

  • python, version 3.9 or higher
  • poetry, version 1.2.0 or higher

Installation

Clone this repo or download it with pip:

git clone https://github.com/zluuba/difference-generator.git
pip install --user git+https://github.com/zluuba/difference-generator.git

Install package and dependencies:

cd difference-generator
make install
make build
make package-install

Commands

Options

gendiff [-h] [-f FORMAT] first_file second_file

-h, --help                # print help text
-f, --format              # set output format

Gendiff commands

# Outputs brief documentation for how to invoke the program
gendiff --help


# Show the differences between two files with stylish formatter
# P.S. stylish is the default formatter, but you can specify it:
# gendiff -f stylish file1.json file2.json
gendiff file1.json file2.json


# Show the differences between two files with plain formatter
gendiff -f plain file1.json file2.json


# Show the differences with json formatter
gendiff -f json file1.yml file2.yml

You can also compare json and yaml file formats in the same command, for example:

gendiff file1.yml file2.json

Demos

Help option, flat files, stylish formatter

asciicast

Nested files, stylish formatter

asciicast

Plain formatter

asciicast

Json formatter

asciicast