Skip to main content

Command line tool to compare properties files

Project description

Github PyPi Python

properties-diff

properties-diff is a command line tools to compare properties files and print differences with colors as if you were using wdiff or diff tools.

Even if properties files are text files, using directly diff is not that efficient because of key/value pairs order or format (for example using = or [space]=[space] as separator, double quoting values...). properties-diff compare key/value pairs but not the order nor the format.

properties-patch is a command line tools to patch a properties files with one or more properties files to add, update or delete some properties.

Install

Install the latest release from PyPI

$ pip3 install properties-diff
$ properties-diff path/to/file.properties path/to/another/file.properties

Install from the sources

$ pip3 install --user --upgrade git+https://github.com/essembeh/properties-diff
$ properties-diff path/to/file.properties path/to/another/file.properties

Usage

$ properties-diff --help                                                                                                                               130
usage: properties-diff [-h] [-q] [--quote] [--sep SEP] [-m {simple,diff,wdiff}] [-A] [-D] [-U] left.properties right.properties

positional arguments:
  left.properties       left file to compare
  right.properties      right file to compare

optional arguments:
  -h, --help            show this help message and exit
  -q, --quiet           print less information
  --quote               use double quotes for values, example: foo="bar"
  --sep SEP             key/value separator, default is '='
  -m {simple,diff,wdiff}, --mode {simple,diff,wdiff}
                        select a format to show differences: using colors only (simple), using diff-like format (diff) or wdiff-like (wdiff) format. Default is 'wdiff'
  -A, --added           print added properties
  -D, --deleted         print deleted properties
  -U, --updated         print updated properties
$ properties-patch --help
usage: properties-patch [-h] [-c] [--comments] [-f] [-i] [--quote] [--sep SEP] [-A] [-D] [-U] -p patch.properties [-o output.properties] source.properties

positional arguments:
  source.properties     file to modify

optional arguments:
  -h, --help            show this help message and exit
  -c, --color           print colors
  --comments            insert comment when property is added, updated or deleted
  -f, --force           force output file (--output) overwrite if it already exists
  -i, --interactive     ask for confirmation to add, update or delete a property
  --quote               use double quotes for values, example: foo="bar"
  --sep SEP             key/value separator, default is '='
  -p patch.properties, --patch patch.properties
                        patch file
  -o output.properties, --output output.properties
                        modified file

  -A, --add             add new properties from patches
  -D, --delete          delete properties not in patches
  -U, --update          update properties from patches

properties-diff modes

You can see differences between the properties files using 3 modes using --mode <MODE> or -m <MODE>

  • wdiff, prints the changes like wdiff tool would do (this is the default mode)
  • diff, prints the changes like diff tool would do
  • simple, based on colors, red for removed lines, green for added lines

wdiff diff simple

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

properties-diff-0.4.1.tar.gz (10.2 kB view hashes)

Uploaded Source

Built Distribution

properties_diff-0.4.1-py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page