Skip to content

antlu/project-lvl2-s463

Repository files navigation

Configuration files comparer

Maintainability Test Coverage Build Status

A tool for showing the difference between configuration files.

Supported formats: JSON, YAML, INI.

Files of different formats are comparable to each other.


Installation

make install
make publish
npm link

Demo

Usage

gendiff --help
Usage: gendiff [options] <firstConfig> <secondConfig>

Compares two configuration files and shows the difference.

Options:
  -f, --format [type]  set output format (default: "tree")
  -V, --version        output the version number
  -h, --help           output usage information

Plain files comparison

gendiff before.json after.json
{
    organization: Acme Widgets Inc.
  - name: John Doe
  + name: Anthony Lu
  - server: 192.0.2.62
  + server: 192.168.0.3
  - port: 143
  + port: 8080
  - file: payroll.dat
  + path: /secret
}

Demo

Comparison of files with nested structure

gendiff before.yaml after.yml
{
    widget: {
      - debug: on
      + debug: off
        window: {
            name: main_window
            width: 500
            height: 500
          - title: Sample Konfabulator Widget
          + title: Sample Widget
          + position: center
        }
        image: {
            name: sun1
            vOffset: 250
          - src: Images/Sun.png
          + src: Images/Moon.png
          - hOffset: 250
          + hOffset: 200
          - alignment: center
          + border: {
                style: dashed
                width: 1px
            }
        }
      - text: {
            data: Click Here
            size: 36
            style: bold
            name: text1
            hOffset: 250
            vOffset: 100
            alignment: center
            onMouseUp: sun1.opacity = (sun1.opacity / 100) * 90;
        }
      + author: person
    }
}

Demo

Setting output in different formats

Supported formats:

  • tree (default)
  • text
  • json
gendiff before.ini after.ini --format=text
Property 'common.setting3' was changed from true to [complex value]
Property 'common.setting6.ops' was added with value: 'vops'
Property 'common.setting2' was removed
Property 'common.follow' was added with value: false
Property 'common.setting5' was added with value: [complex value]
Property 'group1.baz' was changed from 'bas' to 'bars'
Property 'group1.nest.key.key' was changed from 'value' to 'value1'
Property 'group2' was removed
Property 'group3' was added with value: [complex value]

Demo

About

A JSON, YAML, INI configuration files comparer

Resources

Stars

Watchers

Forks