diff --git a/.docs/commands/dyff_between.md b/.docs/commands/dyff_between.md index 9367f8c2..763ecaaa 100644 --- a/.docs/commands/dyff_between.md +++ b/.docs/commands/dyff_between.md @@ -27,6 +27,7 @@ dyff between [flags] -v, --ignore-value-changes exclude changes in values --detect-renames enable detection for renames (document level for Kubernetes resources) (default true) -o, --output string specify the output style, supported styles: human, brief, github, gitlab, gitea (default "human") + --use-indent-lines use indent lines in the output (default true) -b, --omit-header omit the dyff summary header -s, --set-exit-code set program exit code, with 0 meaning no difference, 1 for differences detected, and 255 for program error -l, --no-table-style do not place blocks next to each other, always use one row per text block diff --git a/.docs/commands/dyff_last-applied.md b/.docs/commands/dyff_last-applied.md index 783b24c6..d1614988 100644 --- a/.docs/commands/dyff_last-applied.md +++ b/.docs/commands/dyff_last-applied.md @@ -28,6 +28,7 @@ dyff last-applied [flags] -v, --ignore-value-changes exclude changes in values --detect-renames enable detection for renames (document level for Kubernetes resources) (default true) -o, --output string specify the output style, supported styles: human, brief, github, gitlab, gitea (default "human") + --use-indent-lines use indent lines in the output (default true) -b, --omit-header omit the dyff summary header -s, --set-exit-code set program exit code, with 0 meaning no difference, 1 for differences detected, and 255 for program error -l, --no-table-style do not place blocks next to each other, always use one row per text block diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 6a6aa9e1..dae119fc 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.3.0 + uses: dependabot/fetch-metadata@v2.4.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 778759bd..961e5bd0 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -27,6 +27,6 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: only-new-issues: true diff --git a/README.md b/README.md index 2175c2f8..e4bd1c0d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Codecov](https://img.shields.io/codecov/c/github/homeport/dyff/main.svg)](https://codecov.io/gh/homeport/dyff) [![Go Reference](https://pkg.go.dev/badge/github.com/homeport/dyff.svg)](https://pkg.go.dev/github.com/homeport/dyff) [![Release](https://img.shields.io/github/release/homeport/dyff.svg)](https://github.com/homeport/dyff/releases/latest) +[![Packaging status](https://repology.org/badge/tiny-repos/dyff.svg)](https://repology.org/project/dyff/versions) ![dyff](.docs/logo.png?raw=true "dyff logo - the letters d, y, and f in the colors green, yellow and red") @@ -107,6 +108,21 @@ See [command documentation](.docs/commands/dyff.md) for details about each comma ## Installation +### FreeBSD + +Install via ports: + +```bash +cd /usr/ports/textproc/dyff +make install clean +``` + +Install via package (pkg): + +```bash +pkg install dyff +``` + ### Homebrew The `homeport/tap` has macOS and GNU/Linux pre-built binaries available: @@ -143,7 +159,7 @@ Starting with Go 1.17, you can install `dyff` from source using `go install`: go install github.com/homeport/dyff/cmd/dyff@latest ``` -_Please note:_ This will install `dyff` based on the latest available code base. Even though the goal is that the latest commit on the `main` branch should always be a stable and usable version, this is not the recommended way to install and use `dyff`. If you find an issue with this version, please make sure to note the commit SHA or date in the GitHub issue to indcate that it is not based on a released version. The version output will show `dyff version (development)` for `go install` based builds. +_Please note:_ This will install `dyff` based on the latest available code base. Even though the goal is that the latest commit on the `main` branch should always be a stable and usable version, this is not the recommended way to install and use `dyff`. If you find an issue with this version, please make sure to note the commit SHA or date in the GitHub issue to indicate that it is not based on a released version. The version output will show `dyff version (development)` for `go install` based builds. ## Contributing diff --git a/assets/bosh-yaml/manifest.yml b/assets/bosh-yaml/manifest.yml index 3656e1cc..478a0cb1 100644 --- a/assets/bosh-yaml/manifest.yml +++ b/assets/bosh-yaml/manifest.yml @@ -15,7 +15,7 @@ instance_groups: resource_pool: concourse_resource_pool networks: - name: concourse - static_ips: [XX.XX.XX.XX] # ADD THE STATIC IP ADDRESSES FOR YOUR web INSTACES HERE IF APPLICABLE, OTHERWISE DELETE THIS SECTION + static_ips: [XX.XX.XX.XX] # ADD THE STATIC IP ADDRESSES FOR YOUR web INSTANCES HERE IF APPLICABLE, OTHERWISE DELETE THIS SECTION jobs: - release: concourse name: atc @@ -80,9 +80,9 @@ resource_pools: - name: concourse_resource_pool stemcell: name: bosh-vsphere-esxi-ubuntu-trusty-go_agent # UPDATE ACCORDINGLY WITH THE STEMCELL ID FOR THE TARGETED IaaS - version: '3232.2' # UDPATE ACCORDINGLY WITH THE UPLOADED STEMCELL VERSION + version: '3232.2' # UPDATE ACCORDINGLY WITH THE UPLOADED STEMCELL VERSION network: concourse - cloud_properties: # UDPATE THIS SECTION ACCORDINGLY BASED ON YOUR VM DEFINITIONS AND CLUSTER INFO + cloud_properties: # UPDATE THIS SECTION ACCORDINGLY BASED ON YOUR VM DEFINITIONS AND CLUSTER INFO ram: 4096 disk: 32768 cpu: 2 @@ -94,7 +94,7 @@ compilation: reuse_compilation_vms: true workers: 3 network: concourse - cloud_properties: # UDPATE THIS SECTION ACCORDINGLY BASED ON YOUR VM DEFINITIONS AND CLUSTER INFO + cloud_properties: # UPDATE THIS SECTION ACCORDINGLY BASED ON YOUR VM DEFINITIONS AND CLUSTER INFO ram: 4096 disk: 32768 cpu: 2 diff --git a/go.mod b/go.mod index 9da13d00..764848b2 100644 --- a/go.mod +++ b/go.mod @@ -2,17 +2,19 @@ module github.com/homeport/dyff go 1.23.0 +toolchain go1.24.1 + require ( - github.com/gonvenience/bunt v1.4.0 - github.com/gonvenience/idem v0.0.1 - github.com/gonvenience/neat v1.3.15 - github.com/gonvenience/term v1.0.3 - github.com/gonvenience/text v1.0.8 - github.com/gonvenience/ytbx v1.4.6 + github.com/gonvenience/bunt v1.4.2 + github.com/gonvenience/idem v0.0.2 + github.com/gonvenience/neat v1.3.16 + github.com/gonvenience/term v1.0.4 + github.com/gonvenience/text v1.0.9 + github.com/gonvenience/ytbx v1.4.7 github.com/lucasb-eyer/go-colorful v1.2.0 github.com/mitchellh/hashstructure v1.1.0 - github.com/onsi/ginkgo/v2 v2.23.0 - github.com/onsi/gomega v1.36.2 + github.com/onsi/ginkgo/v2 v2.23.4 + github.com/onsi/gomega v1.38.0 github.com/spf13/cobra v1.9.1 github.com/texttheater/golang-levenshtein v1.0.1 gopkg.in/yaml.v3 v3.0.1 @@ -22,16 +24,16 @@ require ( // cause https://github.com/sergi/go-diff/issues/123 // fixed in https://github.com/sergi/go-diff/pull/136 // but currently not tagged -require github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 +require github.com/sergi/go-diff v1.4.0 require ( - github.com/BurntSushi/toml v1.4.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect + github.com/BurntSushi/toml v1.5.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/pprof v0.0.0-20250128161936-077ca0a936bf // indirect + github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 // indirect @@ -39,14 +41,15 @@ require ( github.com/mitchellh/go-ps v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/spf13/pflag v1.0.6 // indirect + github.com/spf13/pflag v1.0.7 // indirect github.com/stretchr/testify v1.10.0 // indirect github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect - golang.org/x/net v0.37.0 // indirect - golang.org/x/sync v0.12.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/term v0.30.0 // indirect - golang.org/x/text v0.23.0 // indirect - golang.org/x/tools v0.31.0 // indirect + go.uber.org/automaxprocs v1.6.0 // indirect + golang.org/x/net v0.43.0 // indirect + golang.org/x/sync v0.16.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect + golang.org/x/tools v0.36.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index d0c5e037..56b953d3 100644 --- a/go.sum +++ b/go.sum @@ -1,32 +1,33 @@ -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= +github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= +github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= +github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= -github.com/gonvenience/bunt v1.4.0 h1:xRAANCgSmQwGoHIyWg80yFgomTiblBayUUSBBPjDHK4= -github.com/gonvenience/bunt v1.4.0/go.mod h1:J9S2b1ZmUKdvybPxhq0hhrIvAwxcUXJjerudNa2Fhdw= -github.com/gonvenience/idem v0.0.1 h1:SMqv4DI2ErBOsoohVyqBOeCCLrag6N7iClwJbmZBTYo= -github.com/gonvenience/idem v0.0.1/go.mod h1:Br/o1pWtrbiPTuZrn7nPV6TJQL0qbaoGNmJZ8+A7MyU= -github.com/gonvenience/neat v1.3.15 h1:qRMZzVP/HtLsQLKZGW8NGZIXdH1TMHsPjMJe2tvzDqk= -github.com/gonvenience/neat v1.3.15/go.mod h1:TMdu+WVzfRU46GvcMAYALdvlWxiUxP1yqpZn/hKUhP8= -github.com/gonvenience/term v1.0.3 h1:8MleXhMCCzLeWXmiEA/IQ/ZoaKBL5mHrmRVJsU1nWtI= -github.com/gonvenience/term v1.0.3/go.mod h1:VJaaP9pwAlSYSlyv1O7schD/GZJRg8HUmiulQmGOABw= -github.com/gonvenience/text v1.0.8 h1:yIxiyXnKDqfe8JDPldZYaeYHU19XOPNN5VFPETCyNI0= -github.com/gonvenience/text v1.0.8/go.mod h1:pUCCo022AtxoY2LJfJPNBzBc0oC2/Vp+tx8UaIc5RR8= -github.com/gonvenience/ytbx v1.4.6 h1:sXf0/kCBEAbrOBsj8aRpDvdRRkVl/3UZmNLKy4oFY+I= -github.com/gonvenience/ytbx v1.4.6/go.mod h1:LHhrtuB5ghXlU+l1NJJR3Wt1ZnpbQScqyshpXisYplE= +github.com/gonvenience/bunt v1.4.2 h1:nTgkFZsw38SIJKABhLj8aXj2rqion9Zo1so/EBkbFBY= +github.com/gonvenience/bunt v1.4.2/go.mod h1:WjyEO2rSYR+OLZg67Ucl+gjdXPs8GpFl63SCA02XDyI= +github.com/gonvenience/idem v0.0.2 h1:jWHknjPfSbiWgYKre9wB2FhMgVLd1RWXCXzVq+7VIWg= +github.com/gonvenience/idem v0.0.2/go.mod h1:0Xv1MpnNL40+dsyOxaJFa7L8ekeTRr63WaWXpiWLFFM= +github.com/gonvenience/neat v1.3.16 h1:Vb0iCkSHGWaA+ry69RY3HpQ6Ooo6o/g2wjI80db8DjI= +github.com/gonvenience/neat v1.3.16/go.mod h1:sLxdQNNluxbpROxTTHs3XBSJX8fwFX5toEULUy74ODA= +github.com/gonvenience/term v1.0.4 h1:qkCGfmUtpzs9W4jWgNijaGF6dg3oSIh+kZCzT5cPNZY= +github.com/gonvenience/term v1.0.4/go.mod h1:OzNdQC5NVBou9AifaHd1QG6EP8iDdpaT7GFm1bVgslg= +github.com/gonvenience/text v1.0.9 h1:U29BxT3NZnNPcfiEnAwt6yHXe38fQs2Q+WTqs1X+atI= +github.com/gonvenience/text v1.0.9/go.mod h1:JQF1ifXNRaa66jnPLqoITA+y8WATlG0eJzFC9ElJS3s= +github.com/gonvenience/ytbx v1.4.7 h1:3wJ7EOfdv3Lg+h0mzKo7f8d1zMY1EJtVzzYrA3UhjHQ= +github.com/gonvenience/ytbx v1.4.7/go.mod h1:ZmAU727eOTYeC4aUJuqyb9vogNAN7NiSKfw6Aoxbqys= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/pprof v0.0.0-20250128161936-077ca0a936bf h1:BvBLUD2hkvLI3dJTJMiopAq8/wp43AAZKTP7qdpptbU= -github.com/google/pprof v0.0.0-20250128161936-077ca0a936bf/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8= +github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -48,26 +49,29 @@ github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= github.com/mitchellh/hashstructure v1.1.0 h1:P6P1hdjqAAknpY/M1CGipelZgp+4y9ja9kmUZPXP+H0= github.com/mitchellh/hashstructure v1.1.0/go.mod h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/6d8ulp4AwfLKrmA= -github.com/onsi/ginkgo/v2 v2.23.0 h1:FA1xjp8ieYDzlgS5ABTpdUDB7wtngggONc8a7ku2NqQ= -github.com/onsi/ginkgo/v2 v2.23.0/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM= -github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= -github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= +github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus= +github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8= +github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY= +github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= -github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= +github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= +github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= @@ -76,21 +80,23 @@ github.com/texttheater/golang-levenshtein v1.0.1 h1:+cRNoVrfiwufQPhoMzB6N0Yf/Mqa github.com/texttheater/golang-levenshtein v1.0.1/go.mod h1:PYAKrbF5sAiq9wd+H82hs7gNaen0CplQ9uvm6+enD/8= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= -golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= -golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= -google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= -google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/cmd/common.go b/internal/cmd/common.go index 85b5f899..61711278 100644 --- a/internal/cmd/common.go +++ b/internal/cmd/common.go @@ -39,6 +39,7 @@ import ( type reportConfig struct { style string + useIndentLines bool ignoreOrderChanges bool ignoreWhitespaceChanges bool kubernetesEntityDetection bool @@ -60,6 +61,7 @@ type reportConfig struct { var defaults = reportConfig{ style: "human", + useIndentLines: true, ignoreOrderChanges: false, ignoreWhitespaceChanges: false, kubernetesEntityDetection: true, @@ -96,6 +98,7 @@ func applyReportOptionsFlags(cmd *cobra.Command) { // Main output preferences cmd.Flags().StringVarP(&reportOptions.style, "output", "o", defaults.style, "specify the output style, supported styles: human, brief, github, gitlab, gitea") + cmd.Flags().BoolVar(&reportOptions.useIndentLines, "use-indent-lines", defaults.useIndentLines, "use indent lines in the output") cmd.Flags().BoolVarP(&reportOptions.omitHeader, "omit-header", "b", defaults.omitHeader, "omit the dyff summary header") cmd.Flags().BoolVarP(&reportOptions.exitWithCode, "set-exit-code", "s", defaults.exitWithCode, "set program exit code, with 0 meaning no difference, 1 for differences detected, and 255 for program error") @@ -217,6 +220,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error { reportWriter = &dyff.HumanReport{ Report: report, Indent: 2, + UseIndentLines: reportOptions.useIndentLines, DoNotInspectCerts: reportOptions.doNotInspectCerts, NoTableStyle: reportOptions.noTableStyle, OmitHeader: reportOptions.omitHeader, @@ -234,6 +238,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error { HumanReport: dyff.HumanReport{ Report: report, Indent: 0, + UseIndentLines: reportOptions.useIndentLines, DoNotInspectCerts: reportOptions.doNotInspectCerts, NoTableStyle: true, OmitHeader: true, @@ -252,6 +257,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error { HumanReport: dyff.HumanReport{ Report: report, Indent: 0, + UseIndentLines: reportOptions.useIndentLines, DoNotInspectCerts: reportOptions.doNotInspectCerts, NoTableStyle: true, OmitHeader: true, @@ -270,6 +276,7 @@ func writeReport(cmd *cobra.Command, report dyff.Report) error { HumanReport: dyff.HumanReport{ Report: report, Indent: 0, + UseIndentLines: reportOptions.useIndentLines, DoNotInspectCerts: reportOptions.doNotInspectCerts, NoTableStyle: true, OmitHeader: true, diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 7a9abdb4..7c0bb5c9 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -99,7 +99,7 @@ func Execute() error { // Add implicit exclude for metadata.managedFields as this cannot // be configured via a command-line flag using KUBECTL_EXTERNAL_DIFF // due to an bug/feature in kubectl that ignore command-line flags - // in the diff environment variable with non alpha-numeric characters + // in the diff environment variable with non alphanumeric characters reportOptions.excludeRegexps = append(reportOptions.excludeRegexps, "^/metadata/managedFields") } diff --git a/pkg/dyff/core_suite_test.go b/pkg/dyff/core_suite_test.go index 4015c184..98209067 100644 --- a/pkg/dyff/core_suite_test.go +++ b/pkg/dyff/core_suite_test.go @@ -135,6 +135,7 @@ func compareAgainstExpectedHuman(fromPath string, toPath string, expectedPath st reportWriter := &dyff.HumanReport{ Report: report, Indent: 2, + UseIndentLines: true, DoNotInspectCerts: false, NoTableStyle: false, OmitHeader: true, @@ -171,6 +172,7 @@ func compareAgainstExpectedDiffSyntax(fromPath string, toPath string, expectedPa HumanReport: dyff.HumanReport{ Report: report, Indent: 0, + UseIndentLines: true, DoNotInspectCerts: false, NoTableStyle: true, OmitHeader: true, @@ -192,7 +194,7 @@ func compareAgainstExpectedDiffSyntax(fromPath string, toPath string, expectedPa } func yml(input string) *yamlv3.Node { - // If input is a file loacation, load this as YAML + // If input is a file location, load this as YAML if _, err := os.Open(input); err == nil { var content ytbx.InputFile var err error @@ -275,6 +277,7 @@ func humanDiff(diff dyff.Diff) string { reporter := dyff.HumanReport{ Report: dyff.Report{Diffs: []dyff.Diff{diff}}, Indent: 2, + UseIndentLines: true, DoNotInspectCerts: false, NoTableStyle: false, OmitHeader: true, @@ -296,6 +299,7 @@ func diffSyntaxDiff(diff dyff.Diff) string { HumanReport: dyff.HumanReport{ Report: dyff.Report{Diffs: []dyff.Diff{diff}}, Indent: 0, + UseIndentLines: true, DoNotInspectCerts: false, NoTableStyle: true, OmitHeader: true, diff --git a/pkg/dyff/output.go b/pkg/dyff/output.go index a75eb1b7..2dc2d54e 100644 --- a/pkg/dyff/output.go +++ b/pkg/dyff/output.go @@ -26,8 +26,8 @@ import ( "github.com/lucasb-eyer/go-colorful" ) -func yamlStringInRedishColors(input interface{}) (string, error) { - return neat.NewOutputProcessor(true, true, &map[string]colorful.Color{ +func yamlStringInRedishColors(input interface{}, useIndentLines bool) (string, error) { + return neat.NewOutputProcessor(useIndentLines, true, &map[string]colorful.Color{ "keyColor": bunt.FireBrick, "indentLineColor": {R: 0.2, G: 0, B: 0}, "scalarDefaultColor": bunt.LightCoral, @@ -41,8 +41,8 @@ func yamlStringInRedishColors(input interface{}) (string, error) { }).ToYAML(input) } -func yamlStringInGreenishColors(input interface{}) (string, error) { - return neat.NewOutputProcessor(true, true, &map[string]colorful.Color{ +func yamlStringInGreenishColors(input interface{}, useIndentLines bool) (string, error) { + return neat.NewOutputProcessor(useIndentLines, true, &map[string]colorful.Color{ "keyColor": bunt.Green, "indentLineColor": {R: 0, G: 0.2, B: 0}, "scalarDefaultColor": bunt.LimeGreen, diff --git a/pkg/dyff/output_human.go b/pkg/dyff/output_human.go index ffa71a28..eed6634a 100644 --- a/pkg/dyff/output_human.go +++ b/pkg/dyff/output_human.go @@ -53,6 +53,7 @@ type stringWriter interface { type HumanReport struct { Report Indent int + UseIndentLines bool MinorChangeThreshold float64 MultilineContextLines int NoTableStyle bool @@ -184,7 +185,7 @@ func (report *HumanReport) generateHumanDetailOutputAddition(detail Detail) (str } ytbx.RestructureObject(detail.To) - yamlOutput, err := yamlStringInGreenishColors(detail.To) + yamlOutput, err := yamlStringInGreenishColors(detail.To, report.UseIndentLines) if err != nil { return "", err } @@ -214,7 +215,7 @@ func (report *HumanReport) generateHumanDetailOutputRemoval(detail Detail) (stri } ytbx.RestructureObject(detail.From) - yamlOutput, err := yamlStringInRedishColors(detail.From) + yamlOutput, err := yamlStringInRedishColors(detail.From, report.UseIndentLines) if err != nil { return "", err } @@ -381,7 +382,7 @@ func (report *HumanReport) writeStringDiff(output stringWriter, from string, to del++ case diffmatchpatch.DiffEqual: - // skip eqaul output if requested context is 0 or the equal text is empty + // skip equal output if requested context is 0 or the equal text is empty if multilineContextLines <= 0 || len(d.Text) == 0 { continue }