mariya/gendiff

此包最新版本(v6.0.1)没有提供许可证信息。

第二个PHP项目,用于在配置文件中查找差异的工具。

v6.0.1 2019-04-16 04:09 UTC

This package is auto-updated.

Last update: 2024-09-16 16:22:26 UTC


README

Maintainability Build Status

PHP控制台工具,用于查找配置文件中的差异。

工具特性

  • 多格式支持
  • 生成纯文本、格式化文本和json格式的报告

安装

通过Composer

$ composer require mariya/gendiff

使用方法

获取帮助

$ gendiff -h

生成两个文件(jsonyaml)之间的差异

$ gendiff before.json after.json

此工具支持不同的输出格式。默认情况下,报告以格式化方式生成。示例

$ gendiff before.json after.json

{
    host: hexlet.io
  + timeout: 20
  - timeout: 50
  - proxy: 123.234.53.22
  + verbose: true
}

使用--format选项和plain值来获取以下格式的报告

$ gendiff --format plain before.json after.json

Property 'timeout' was changed. From '50' to '20'
Property 'proxy' was removed
Property 'verbose' was added with value: 'true'

此外,您还可以使用适当的选项值获取json格式的报告

$ gendiff --format json before.json after.json

{"0":{"key":"host","type":"unchanged","valueBefore":"hexlet.io","valueAfter":"hexlet.io","children":null},"1":{"key":"timeout","type":"changed","valueBefore":50,"valueAfter":20,"children":null},"2":{"key":"proxy","type":"deleted","valueBefore":"123.234.53.22","valueAfter":null,"children":null},"3":{"key":"verbose","type":"added","valueBefore":null,"valueAfter":true,"children":null}}