Package: properties-tools
properties-toolsproperties-toolsis a collection of command line tools to work withpropertiesfiles: comparing likewdiff, updating likepatch...The idea is to work with thecontent(key/valuepairs) instead of thetext, to ignore order or format and deal with the data.properties-diffcan compare and print differences between 2propertiesfiles, with fancy colors as if you were usingwdiffordifftools. It does not compare thetextfiles.properties-patchcan update apropertiesfile using values from others, you can choose toaddnew keys and/orupdateexisting and/orremoveothers.InstallInstall the latest release fromPyPI$pip3installproperties-diff
$properties-diff--helpInstall from the sources$pip3installpoetry
$pip3installgit+https://github.com/essembeh/properties-tools
$properties-diff--helpproperties-diffUsage$properties-diff--helpusage:properties-diff[-h][--version][-q][--quote][--color|--nocolor][--sepSEP][-m{simple,diff,wdiff}|--diff|--wdiff|--simple][-A][-D][-U]left.propertiesright.properties

positionalarguments:left.propertiesleftfiletocompareright.propertiesrightfiletocompare

optionalarguments:-h,--helpshowthishelpmessageandexit--versionshowprogram's version number and exit-q, --quiet           print less information--quote               use double quotes for values, example: foo="bar"--color               force colors--nocolor             disable colors--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'--diffusediff-likeformattoshowdifferences--wdiffusewdiff-likeformattoshowdifferences--simpleusesimpleformattoshowdifferences-A,--addedprintaddedproperties-D,--deletedprintdeletedproperties-U,--updatedprintupdatedpropertiesExamplesComparingpropertiesfiles likewdiff$properties-difftests/sample1.propertiestests/sample2.properties
---tests/sample1.properties(left)2022-04-0712:48:44
+++tests/sample2.properties(right)2022-04-0712:49:02# Only in tests/sample1.properties (left)[-database.host=localhost-]# Only in tests/sample2.properties (right){+database.version=12+}# Updated from tests/sample1.properties (left) to tests/sample2.properties (right)database.type=[-postgresql-]{+mysql+}database.user=[-test-]{+dbuser+}Comparingpropertiesfiles likediff$properties-difftests/sample1.propertiestests/sample2.properties--diff
---tests/sample1.properties(left)2022-04-0712:48:44
+++tests/sample2.properties(right)2022-04-0712:49:02# Only in tests/sample1.properties (left)-database.host=localhost# Only in tests/sample2.properties (right)+database.version=12# Updated from tests/sample1.properties (left) to tests/sample2.properties (right)-database.type=postgresql
+database.type=mysql
-database.user=test+database.user=dbuserCompare files, but only showupdateedandaddedvalues$properties-difftests/sample1.propertiestests/sample2.properties--add--update
---tests/sample1.properties(left)2022-04-0712:48:44
+++tests/sample2.properties(right)2022-04-0712:49:02# Only in tests/sample2.properties (right){+database.version=12+}# Updated from tests/sample1.properties (left) to tests/sample2.properties (right)database.type=[-postgresql-]{+mysql+}database.user=[-test-]{+dbuser+}Viewing modesYou can seedifferencesbetween thepropertiesfiles using 3 modes using--mode <MODE>or-m <MODE>wdiff, prints the changes likewdifftool would do (this is the default mode)diff, prints the changes likedifftool would dosimple, based on colors,redfor removed lines,greenfor added linesproperties-patchUsage$properties-patch--helpusage:properties-patch[-h][--version][--color|--nocolor][-c][-i][--quote][--sepSEP][-A][-D][-U]-ppatch.properties[-ooutput.properties|-w][-f]source.properties

positionalarguments:source.propertiesfiletomodify

optionalarguments:-h,--helpshowthishelpmessageandexit--versionshowprogram's version number and exit--color               force colors--nocolor             disable colors-c, --comments        insert comment when property is added, updated or deleted-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 '='-ppatch.properties,--patchpatch.propertiespatchfile-ooutput.properties,--outputoutput.propertiesmodifiedfile-w,--overwriteupdateinputpropertiesfileinplace-f,--forceforceoutputfile(--output)overwriteifitalreadyexists-A,--addaddnewpropertiesfrompatches-D,--deletedeletepropertiesnotinpatches-U,--updateupdatepropertiesfrompatchesExamplesBuild a properties file fromtests/sample1.propertiesand add missing keys fromtests/sample2.properties$properties-patchtests/sample1.properties--patchtests/sample2.properties--add# just a commentdatabase.type=postgresql
database.host=localhost
database.port=5432# and another commentdatabase.user=testdatabase.password=foobar
database.version=12You can use multiplepatchfiles, if a value is present in multiplepatchfiles, the latest value will be used.$properties-patchtests/sample1.properties--patchtests/sample2.properties--patchtests/sample3.properties-A# just a commentdatabase.type=postgresql
database.host=localhost
database.port=5432# and another commentdatabase.user=testdatabase.password=foobar
database.version=42You can choose toaddmissing values andupdatevalues that are different in thepatchfiles$properties-patchtests/sample1.properties--patchtests/sample2.properties-AU# just a commentdatabase.type=mysql
database.host=localhost
database.port=5432# and another commentdatabase.user=dbuser
database.password=foobar
database.version=12There is aninteractivemode, which ask for confirmation before every change (usefull to take only some changes, equivalent togit add --interactive)$properties-patchtests/sample1.properties--patchtests/sample2.properties-AU--interactive# just a comment💬Updatedatabase.type=postgresql,mysql?[Y/n]database.type=mysql
database.host=localhost
database.port=5432# and another comment💬Updatedatabase.user=test,dbuser?[Y/n]database.user=dbuser
database.password=foobar
💬Adddatabase.version=12?[Y/n]database.version=12To track changes, you can add comments for every change applied$properties-patchtests/sample1.properties--patchtests/sample2.properties-ADU--comments# just a comment# 2022-04-07 23:12:11  update: database.type=postgresqldatabase.type=mysql# 2022-04-07 23:12:11  remove: database.host=localhostdatabase.port=5432# and another comment# 2022-04-07 23:12:11  update: database.user=testdatabase.user=dbuser
database.password=foobar# 2022-04-07 23:12:11  add: database.versiondatabase.version=12