Giter VIP home page Giter VIP logo

diffant's Introduction

diffant

diffant uses the structure of configuration files to do a more helpful comparison than standard diff.

diffant allows you to compare:

  • ini
  • json
  • yaml
  • xml

For example, for the purpose of comparing configuration, these two files are the same. There should be no diff:

file_01.ini file_02.ini
[info] [info]
[email protected] phone=212-555-1212
phone=212-555-1212 email = [email protected]

diffant can meaningfully compare a heavily commented original configuration file with many lines to a minimized comment-less configuration file and find how the defaults have changed.

You are not limited to comparing 2 files, diffant can compare many files.

SAMPLE OUTPUT

fruit:  apple
          tests/sample_input.dirs/simple/file01.json
          tests/sample_input.dirs/simple/file03.json

        cherry
          tests/sample_input.dirs/simple/file02.json

        /*MISSING*/
          tests/sample_input.dirs/simple/file04.json

grain:  rice
          tests/sample_input.dirs/simple/file01.json

        /*MISSING*/
          tests/sample_input.dirs/simple/file02.json
          tests/sample_input.dirs/simple/file03.json
          tests/sample_input.dirs/simple/file04.json

inspiration:art:  Pablo Picasso
                    tests/sample_input.dirs/simple/file01.json
                    tests/sample_input.dirs/simple/file03.json

                  Frida Kahlo
                    tests/sample_input.dirs/simple/file02.json

                  /*MISSING*/
                    tests/sample_input.dirs/simple/file04.json

inspiration:music:  Dead Kennedys
                      tests/sample_input.dirs/simple/file01.json
                      tests/sample_input.dirs/simple/file02.json
                      tests/sample_input.dirs/simple/file03.json

                    /*MISSING*/
                      tests/sample_input.dirs/simple/file04.json

inspiration:tools:0:  hammer
                        tests/sample_input.dirs/simple/file02.json

                      /*MISSING*/
                        tests/sample_input.dirs/simple/file01.json
                        tests/sample_input.dirs/simple/file03.json
                        tests/sample_input.dirs/simple/file04.json

inspiration:tools:1:  rack
                        tests/sample_input.dirs/simple/file02.json

                      /*MISSING*/
                        tests/sample_input.dirs/simple/file01.json
                        tests/sample_input.dirs/simple/file03.json
                        tests/sample_input.dirs/simple/file04.json

vegetable:  spinach
              tests/sample_input.dirs/simple/file03.json

            /*MISSING*/
              tests/sample_input.dirs/simple/file01.json
              tests/sample_input.dirs/simple/file02.json
              tests/sample_input.dirs/simple/file04.json

SAMPLE INPUT

file01.json

{
"grain": "rice",
"color": "red",
 "fruit": "apple",
 "inspiration": {"art":"Pablo Picasso","music":"Dead Kennedys"}
}

file02.json

  {
   "color": "red",
   "fruit": "cherry",
   "inspiration": {"art":"Frida Kahlo","music":"Dead Kennedys","tools":["hammer","rack"]}
  }

file03.json

 {
   "vegetable": "spinach",
   "color": "red",
   "fruit": "apple",
   "inspiration": {"art":"Pablo Picasso","music":"Dead Kennedys"}
  }

file04.json

{
   "color": "red"
  }

REQUIREMENTS

  • pip
  • python >= 3.8

LICENSE

GNU General Public License v3.0

SETUP

pip3 install diffant

USAGE

diffant  <directory with files of same type>

BUGS

  1. The files you are comparing need to be at the top level of a directory that you supply as a positional argument to diffant
  2. The files need to have an extension that reflects their contents (ini,json.yml)
  3. You can't compare files of different types or have files of different types in your input directory.

SUPPORT

[email protected]

CONTRIBUTORS

  • @morgan: Helpful tweak to README.md
  • cpat-gpt: about 50% of the code

diffant's People

Contributors

omacneil avatar

Watchers

 avatar

Forkers

marwan116

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.