dyff

/ˈdʏf/ - diff tool for YAML files, and sometimes JSON

MIT License

Stars
1.3K
Committers
22

Bot releases are hidden (Show)

dyff - dyff version v0.5-beta.8

Published by HeavyWombat over 6 years ago

CLI flag clean-up

Fixed missing usage information and harmonised the shorthand and long flag names.

Certificate output tweak

Changed the certificate output by adding grouping to subject and validation period as well as improvement to the coloring of the changes.

New flag for the neat output

The vertical indent helper guide lines can now be omitted in the output by using the respective flag.

Internal code improvements

Clean-up of test cases and unification of styles within the test cases. Code refactoring of the path code, which was moved into its own source file for readability.

dyff - dyff version v0.5-beta.7

Published by HeavyWombat over 6 years ago

Support non-standard identifier in named lists

Add function to guess the identifier if the default identifier name,
key, or id do not work. It will guess based on the fact if there is
a string key with string value, where each value is unique in the
list as long as the list has more than n values with n currently
being 3. This threshold might be subject to change in the future or
become configurable.

dyff - dyff version v0.5-beta.6

Published by HeavyWombat over 6 years ago

Fix YAML output issue with empty structures

Add checks to spot empty structures such as empty map or empty list
to properly display its empty inline JSON style in the YAML output.

dyff - v0.5-beta.5

Published by HeavyWombat over 6 years ago

Add True Color support

Use more than just 16 colors to highlight changes.

Add automatic check for color and true color support

Only use true color if terminal supports it. Add new flags to enforce colors or disable them.

Remove Go YAML library fork dependency

Rewrite of the output of YAML strings to avoid having a fork dependency.

Add 4-bit fallback option

In case true color is not supported, dyff will fall back to 16 colors and automatically check which of the reduced color sets matches best.

Improve test cases

Added checks to verify remote location loading is properly handled.

dyff - dyff version v0.5-beta.2

Published by HeavyWombat over 6 years ago

Add True Color support

Replaced the previous ANSI coloring library with a new internal package that comes with True Color support.

Enhanced minor change output

If only a certain percentage of a string was changed, use a different output in the human style report to better visualise the minor change in the string. Currently, this threshold is configured to be roughly 10 %.

dyff - dyff version v0.5-beta.1

Published by HeavyWombat over 6 years ago

Implement change root support

Add flags and implementation code to support changing the root level of a given input file, or both. Depending on the actual object that is referenced by the path that serves as the new root level, there are use cases where a list should be translated into documents, or where the list is used as the root level itself.

This enables diffs between YAMLs (or JSON) with different types of structures, for example:

---
a: foo
---
a: bar

compared with

{
  "items": [
    {"a": "Foo"},
    {"a": "bar"}
  ]
}

image

Big thanks to @adamdecaf for the idea.

dyff - dyff version v0.4-alpha

Published by HeavyWombat over 6 years ago

Introduced multi-document support for YAMLs

Added multi-document support and test cases.

Updated vendor directory.

Added support for root level simple lists.

Cleaned up the test cases to have a nice list helper function.

In the output, the document index should only be visible if there are
multiple documents loaded.

dyff - dyff version v0.3-alpha

Published by HeavyWombat over 6 years ago

Fixed duplicate newline issue

The usage of newlines in output details was not implemented in a
common fashion resulting in different numbers of newlines in
different output scenarios. This was fixed by using a common style
and by avoiding newlines in the helper functions. Instead, before
each path is displayed, the first separating newline is produced.

Added fixed terminal width option

There might be cases where a fixed terminal width is helpful,
especially if the terminal width detection fails

Added missing copyright header

Most of the core Go files and the shell script were missing the
copyright header. Not that this is very important at the moment,
but it was a nice way to enforce all files to have it and to be
UTF-8 at the same time.

Whitespace only changes in table style

Changes the code so that whitespace only changes are also displayed
in table style if terminal size permits. The output should look
similar to the other output styles. Added a couple of TODOs for
improvement of the code.

Simplified output code

Removed Cols usage by using already existing code from
createStringWithPrefix to get string with a common prefix
and correct multi-line indentation.

Added convenience download script

A convenience script to download the latest dyff compiled
version from GitHub was added. It will perform a GitHub API
call to get the latest version tag and then perform a simple
download via curl. For the GitHub API call the jq tool
is used to parse the JSON.

Fixed shellcheck issues

The shell check tool reported minor issues in the compile script
that were fixed. Added ANSI coloring for better readability.

Fixed terminal width issue (again)

Reverted back to
golang.org/x/crypto/ssh/terminal
as the package to get the terminal size for both Linux and Windows
systems.

dyff - dyff version v0.2-alpha

Published by HeavyWombat over 6 years ago

Switched terminal width detection

Changed code to detect terminal width to be more operating system independent.

Updated vendor directory

Pulled in updates for vendor directory that contain updates to
the https://github.com/spf13 package.

Improved cert delta output

Removed github.com/grantae/certinfo dependency in favour
for an output that looks like the summary from
https://www.sslshopper.com/certificate-decoder.html.

Output improvements for certificates

Added flag --no-cert-inspection to disable certificate decoding
for content comparision. This will result in raw-text compare. This
fix includes another output improvement that tries to display
multi-line strings next to each other.

Added restructure feature

If dealing with generated YAML files leaves you with reordered
hashes that render the output hard to read, you can now let this
tools reorder some known keys into a more human pleasing order.

Fixed nice location output

The nice location function returned paths like /dev/fd as
URIs even though they are clearly file system paths. This was
fixed by checking the file existence with stats first.

Fixed location loading

There was an issue with the order of checks while loading the
input data. It was reworked and separated into two functions
so that there is a clear path what is checked in which order.

Reworked use of panic

Introduced a function to Exit with a provided error and switched
to this function as much as possible. There are only a couple of
panic calls left, all at positions where they should be deadcode.

Initial update to avoid panic output

Added function to exit program with a text and the provided error
text from the actual Go error. Reworked the file loading part to
return a proper error if the file cannot be found. This will now
be displayed on STDOUT and a non-zero exit status.

Add swap flag

Added flag for between subcommand to swap both input arguments.
There are actually use cases where this is helpful, believe it or not.

Ignore order changes in hashs as diffs

The order of keys in hashes is interesting for a human, but does not matter
from a semantic point of view. Therefore, in simple lists dyff will convert
MapSlices into maps before creating a hash of the entry so that the order
does not matter.

Support order change detection in simple lists

Added code to detect order changes in simple lists based on the hash
of the respective entries. The output currently displays the order of
the entries that are common to both lists. This might be subject to
changes in the future if this turn out to be too much data to be
displayed.

Terminal output improvement

Checks were added to verify the terminal width is big enough to display
elements next to each other. This includes the order change output,
which is most likely to use a lot of horizontal space. Order changes
output lists will either be displayed as a single line if they consume
less than 50 % of the terminal width, or multi line otherwise.

Added cross-compile script

The new compile script will compile dyff for various platforms

dyff - dyff version v0.1-alpha

Published by HeavyWombat over 6 years ago

Initial release of dyff with core features implemented:

  • Show difference between two provided YAML files in BOSH v1 look-a-like style.
  • Support for JSON as input files.
  • Support for URIs as input locations.
  • YAML to JSON and vice versa conversion while preserving the order in hashes.
  • X509 certificates are decoded to show differences of the certificate content.
  • Order changes in named entry lists are shown.