rustam/php-project-lvl2

v1.0 2020-06-22 17:24 UTC

This package is auto-updated.

Last update: 2024-04-15 22:20:19 UTC


README

badge.svg?branch=master Maintainability Test Coverage

Gendiff

This is a tutorial project that implements a file comparison utility.

To install via composer, enter in the console:

composer global require rustam/php-project-lvl2

Type for help.

gendiff -h
Generate diff

Usage: gendiff (-h|--help) gendiff (-v|--version) gendiff [--format <fmt>] <firstFile> <secondFile>

Options: -h --help Show this screen -v --version Show version --format <fmt> Report format [default: pretty]

Also this utility can be used as a function. Example:

genDiff('before.json', 'after.json', 'plain);

before.json after.json paths to files. format - output format.

You can use absolute and relative file paths to compare files

68747470733a2f2f61736369696e656d612e6f72672f612f3333343532362e706e67

The utility is also capable of comparing files with a nested structure.

68747470733a2f2f61736369696e656d612e6f72672f612f5139424245707875706b38616872684d7155653333476348592e706e67

The utility is capable of displaying the result in three versions

-Plian -Pretty [default] -JSON

JSON:

68747470733a2f2f61736369696e656d612e6f72672f612f31537453623268433655686a6d506657424d6b4551773746352e737667

Plain:

68747470733a2f2f61736369696e656d612e6f72672f612f7558703553386b394f567754727a394234525148506961557a2e737667

Supported file formats for comparison: .json .yaml .yml