https://github.com/blazecolour/gendiff-cli
cli app for compares json, yaml and ini files
https://github.com/blazecolour/gendiff-cli
cli diff hexlet ini javascript json nodejs yml
Last synced: about 2 months ago
JSON representation
cli app for compares json, yaml and ini files
- Host: GitHub
- URL: https://github.com/blazecolour/gendiff-cli
- Owner: blazecolour
- License: mit
- Created: 2018-07-16T21:13:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-26T13:51:18.000Z (almost 7 years ago)
- Last Synced: 2025-02-20T06:47:18.875Z (2 months ago)
- Topics: cli, diff, hexlet, ini, javascript, json, nodejs, yml
- Language: JavaScript
- Homepage:
- Size: 204 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# gendiff-cli
[](https://codeclimate.com/github/blazecolour/gendiff-cli/maintainability)
[](https://coveralls.io/github/blazecolour/gendiff-cli?branch=master)
[](https://travis-ci.org/blazecolour/gendiff-cli)[](https://nodei.co/npm/gendiff-blazecolour-2/)
A tool for files differences by parsing them into AST, sorting them, and comparing the stringified output. Useful for finding changes in configuration files.
## Install
#### CLI:
```npm install -g gendiff-blazecolour-2```
#### library:
```npm install --save gendiff-blazecolour-2```
## Usage
#### CLI usage:
```bash
$ gendiff [options]
```#### API usage:
```js
import genDiff from 'gendiff-blazecolour-2';genDiff('path/to/file1', 'path/to/file2', format);
```## CLI options
```
-v, --version Output the version number
-f, --format [type] Output format: tree, plain, json (default: tree)
-h, --help Output usage information
```## Available format files
The following extensions are available for input files:
- [x] json
- [x] yml
- [x] iniThe output formats:
* tree
* plain
* json## Examples
Comparing two json files.
#### Output
file1:
```json
{
"host": "hexlet.io",
"timeout": 50,
"proxy": "123.234.53.22",
"follow": false
}
```file2:
```json
{
"timeout": 20,
"verbose": true,
"host": "hexlet.io"
}
```#### input
tree format:
```diff
{
host: hexlet.io
+ timeout: 20
- timeout: 50
- proxy: 123.234.53.22
+ verbose: true
- follow: false
}
```plain format:
```diff
Property 'timeout' was changed. From '50' to '20'
Property 'proxy' was deleted
Property 'follow' was deleted
Property 'verbose' was added with value: 'true'
```## Asciinema
[](https://asciinema.org/a/193582)
## License
**[MIT](./LICENSE.md)**