README
Gendiff
Gendiff is an npm module that generates the difference between two configuration files and formats it into a string
The following configuration file types are supported: json (.json), yaml (.yml), ini (.ini)
This is the lvl-2 frontend project on https://ru.hexlet.io/
Example
In this example three pairs of files are containing the same data, but in different formats. Because the data itself is the same, the gendiff applied to all the three sets of data will lead to equal results:
file1.json | file2.json | result (stylish) | result (plain) | result (json) |
---|---|---|---|---|
|
|
|
|
[{"type":"leaf","name":"hello","status":"removed","value":"world"},{"type":"leaf","name":"number","status":"added","value":17},{"type":"node","name":"obj","children":[{"type":"leaf","name":"foo","status":"unchanged","value":"bar"},{"type":"node","name":"node","children":[{"type":"leaf","name":"array","status":"unchanged","value":[1]},{"type":"leaf","name":"str","status":"modified","valueBefore":"jkl;","valueAfter":"asdf"}]}]}] |
file1.yml | file2.yml | |||
|
|
|||
file1.ini | file2.ini | |||
|
|
Install
npm install -g @vaziliybober/gendiff
Clone
git clone https://github.com/vaziliybober/gendiff.git
cd gendiff/
make install
make link
Use
Usage: gendiff [options] <filepath1> <filepath2>
Compares two configuration files and shows a difference.
Options:
-V, --version output the version number
-f, --format [type] output format (default: "stylish")
-h, --help output usage information