This repository is created and maintained by a student of the Hexlet educational project community. Is a utility for finding differences in configuration files. Read more about Hexlet (in Russian).
clone git and npm install
$ npm install$ gendiff
/usr/bin/env: 'node': No such file or directorythen enter the command
$ sudo ln -s $(which nodejs) /usr/local/bin/nodeThis should solve the problem.
- program supports four input file types:
.yml.ini.json - program supports three output types:
plaindiffjson $ gendiff before.json after.jsonget diff with default output$ gendiff --format json before.yml after.ymlget full diff tree with JSON output-f | --format [type]formating output to tree, json or plain, default is tree-h | --helphelp page-V | --versionprogram version
$ gendiff before.json after.json
{
group1: {
- baz: bas
+ baz: bars
foo: bar
- nest: {
key: value
}
+ nest: str
}
- group2: {
abc: 12345
}
+ group3: {
fee: 100500
}
}
$ gendiff --format plain before.json after.json
Property 'group1.baz' was updated. From 'bas' to 'bars'
Property 'group1.nest' was updated. From complex value to 'str'
Property 'group2' was removed
Property 'group3' was added with [complex value]
$ gendiff --format json before.json after.json
[
{
"key": "group1",
"type": "nest",
"children": [
{
"key": "baz",
"type": "updated",
"valueBefore": "bas",
"valueAfter": "bars"
},
{
"key": "foo",
"value": "bar",
"type": "unchanged"
},
{
"key": "nest",
"type": "updated",
"valueBefore": {
"key": "value"
},
"valueAfter": "str"
}
]
},
{
"key": "group2",
"type": "deleted",
"value": {
"abc": "12345"
}
},
{
"key": "group3",
"type": "added",
"value": {
"fee": "100500"
}
}
]