https://github.com/snokke/difference-calc-hexlet-project2
Difference calculator. Compares two configuration files and shows a difference
https://github.com/snokke/difference-calc-hexlet-project2
commanderjs hexlet jest npm
Last synced: 2 months ago
JSON representation
Difference calculator. Compares two configuration files and shows a difference
- Host: GitHub
- URL: https://github.com/snokke/difference-calc-hexlet-project2
- Owner: Snokke
- Created: 2018-10-29T08:13:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T16:25:17.000Z (over 3 years ago)
- Last Synced: 2025-08-16T05:28:51.325Z (10 months ago)
- Topics: commanderjs, hexlet, jest, npm
- Language: JavaScript
- Homepage:
- Size: 1.22 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Difference calculator
[](https://codeclimate.com/github/Snokke/difference-calc-hexlet-project2/maintainability)
[](https://codeclimate.com/github/Snokke/difference-calc-hexlet-project2/test_coverage)
[](https://travis-ci.org/Snokke/difference-calc-hexlet-project2)
## Install
```sh
npm install -g project2-snokke
```
## Description
```
Usage: gendiff [options]
Compares two configuration files and shows a difference.
Options:
-V, --version output the version number
-f, --format [type] output format: pretty, plain, json (default: "pretty")
-h, --help output usage information
```
Supported file formats: **json**, **yaml**, **ini**
Supported output formats: **pretty**, **flat**, **json**
## Demo
Pretty format ([Asciinema](https://asciinema.org/a/wGMDMUJGVqpTTeywxIXlpW7YM?speed=4)):
```
bash-3.2$ gendiff before.json after.json
{
common: {
setting1: Value 1
- setting2: 200
+ setting3: {
key: value
}
- setting3: true
setting6: {
key: value
+ ops: vops
}
+ follow: false
+ setting4: blah blah
+ setting5: {
key5: value5
}
}
group1: {
+ baz: bars
- baz: bas
foo: bar
+ nest: str
- nest: {
key: value
}
}
- group2: {
abc: 12345
}
+ group3: {
fee: 100500
}
}
```
Flat format ([Asciinema](https://asciinema.org/a/BOJAFXoE62rT1XoC0fIqazVuj?speed=4)):
```
bash-3.2$ gendiff --format plain before.json after.json
Property 'common.setting2' was removed
Property 'common.setting3' was updated. From true to [complex value]
Property 'common.setting6.ops' was added with value: 'vops'
Property 'common.follow' was added with value: false
Property 'common.setting4' was added with value: 'blah blah'
Property 'common.setting5' was added with value: [complex value]
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 value: [complex value]
```