Skip to content

davydovks/php-project-48

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

154 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gendiff

Actions Status Maintainability Test Coverage

About

Gendiff compares two configuration files and shows a difference. It can be used both in terminal and as a library. Acceptable input file formats are JSON and YAML.

Setup

$ git clone https://github.com/davydovks/php-project-48.git

$ cd php-package-48

$ make install

Usage

As a library

Description

genDiff(string $pathToFile1, string $pathToFile2, string $format = 'stylish'): string

Parameters

  • pathToFile1 - Absolute or relative path to the first file to compare.
  • pathToFile2 - Absolute or relative path to the second file to compare.
  • format - Output format. Possible fromats: stylish, plain, json. Default value is 'stylish'.

Example

<?php

use function Differ\Differ\genDiff;

$diff = genDiff($pathToFile1, $pathToFile2, $format);
print_r($diff);

Usage in CLI

Usage:
  gendiff [options] <firstFile> <secondFile>

Options:
  -h, --help                    Show help screen
  -v, --version                 Show version
  -f, --format <fmt>            Report format [default: stylish]

Demos

Comparing two plain JSON files, stylish output

asciicast

Comparing two plain YAML files, stylish output

asciicast

Comparing multilevel JSON and YAML files, stylish output

asciicast

Comparing two multilevel JSON files, plain output

asciicast

Comparing multilevel JSON and YAML files, all output formats

asciicast

About

Difference Generator - cli tool to compare two JSON or YAML files.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors