用于比较属性文件的命令行工具
项目描述
属性差异
properties-diff
是一个命令行工具,用于比较属性文件并使用颜色打印差异,就像您使用wdiff
或diff
工具一样。
即使属性文件是文本文件,diff
由于键/值对的顺序或格式(例如使用=
或[space]=[space]
作为分隔符、双引号值...),直接使用也不是那么有效。properties-diff
比较键/值对,但不比较顺序或格式。
properties-patch
是一个命令行工具,用于修补属性文件,其中包含一个或多个属性文件以添加、更新或删除某些属性。
安装
从PyPI安装最新版本
$ pip3 install properties-diff
$ properties-diff path/to/file.properties path/to/another/file.properties
从源安装
$ pip3 install --user --upgrade git+https://github.com/essembeh/properties-diff
$ properties-diff path/to/file.properties path/to/another/file.properties
用法
$ 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
属性差异模式
您可以使用 3 种模式查看属性文件之间的--mode <MODE>
差异-m <MODE>
wdiff
, 打印wdiff
工具所做的更改(这是默认模式)diff
, 打印diff
工具所做的更改simple
, 基于颜色,红色表示删除的线条,绿色表示添加的线条
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
properties-diff-0.4.1.tar.gz
(10.2 kB
查看哈希)
内置分布
properties_diff-0.4.1-py3-none-any.whl
(11.5 kB
查看哈希)