Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Utility that compares two configuration files and shows a difference.

Notifications You must be signed in to change notification settings

vadimfilimonov/frontend-project-lvl2

Repository files navigation

Gendiff

Hexlet tests and linter status:

Hexlet Check Status Linter Status Test Status Maintainability Test Coverage

Description

Gendiff – a program that detects the difference between two data structures.

Installation

$ git clone git@github.com:VadimFilimonov/frontend-project-lvl2.git
$ make install
$ npm link

Usage

$ gendiff [options] <filepath1> <filepath2>

Options:

  • -V, --version output the version
  • -f, --format [type] output format
    • [type] - stylish, plain, json
  • -h, --help output usage information

<filepath> - path to json or yaml file

asciicast

Examples

Flat JSON

file1.json

{
  "host": "hexlet.io",
  "timeout": 50,
  "proxy": "123.234.53.22",
  "follow": false
}

file2.json

{
  "timeout": 20,
  "verbose": true,
  "host": "hexlet.io"
}

asciicast

Flat YML

file1.yml

host: hexlet.io,
timeout: 50,
proxy: 123.234.53.22,
follow: false

file2.yml

timeout: 20,
verbose: true,
host: hexlet.io

asciicast

Stylish format

file1.json

{
  "common": {
    "setting1": "Value 1",
    "setting2": 200,
    "setting3": true,
    "setting6": {
      "key": "value",
      "doge": {
        "wow": ""
      }
    }
  },
  "group1": {
    "baz": "bas",
    "foo": "bar",
    "nest": {
      "key": "value"
    }
  },
  "group2": {
    "abc": 12345,
    "deep": {
      "id": 45
    }
  }
}

file2.json

{
  "common": {
    "follow": false,
    "setting1": "Value 1",
    "setting3": null,
    "setting4": "blah blah",
    "setting5": {
      "key5": "value5"
    },
    "setting6": {
      "key": "value",
      "ops": "vops",
      "doge": {
        "wow": "so much"
      }
    }
  },
  "group1": {
    "foo": "bar",
    "baz": "bars",
    "nest": "str"
  },
  "group3": {
    "deep": {
      "id": {
        "number": 45
      }
    },
    "fee": 100500
  }
}

Next examples have same json files

asciicast

Plain format

asciicast

JSON format

asciicast

About

Utility that compares two configuration files and shows a difference.

Topics

Resources

Stars

Watchers

Forks