Comments (12)
Thanks for the feedback. I would like to have that option, too. Even started to work on it. The "problem" so to speak is the current path implementation. It is not really how I like it, not really flexible or good in terms of design. So I am not sure whether I want to hack the feature into the current design or if I finally do the redesign of the path implementation.
from dyff.
I am also interested in --exclude feature
from dyff.
I’ve added —exclude
, —filter-regexp
and —exclude-regexp
options on my own fork.
This fork is not assumed to merge to upstream because I think @HeavyWombat had started to work on this issue and this issue will be resolved in the near future.
But if you want to try it before then, feel free to use it.
https://github.com/sachaos/dyff/tree/feature/filter-or-exclude-by-regexp
from dyff.
@sachaos You know what, if you have something already, why not just PR it to dyff
here and we aim for a new release with those features you have. Ignore my previous comment. I just have some experiments laying around.
from dyff.
Yes, that was a bit of an oversight, when we did the --filter
implementation. It is definitely on my list of things to be fixed soon. It is similar to #161.
from dyff.
Exclusion of paths would also be very nice (e.g. filtering of server-side generated metadata by k8s controllers).
I also tried to use the filter as it is currently implemented using two files generated by kustomize, but it seems that this does not work correctly. There are multiple documents in a single file. Doing the dyff results in 1 diff. By using the reported path as filter no diff is reported.
from dyff.
Exclusion of paths would also be very nice (e.g. filtering of server-side generated metadata by k8s controllers).
I also tried to use the filter as it is currently implemented using two files generated by kustomize, but it seems that this does not work correctly. There are multiple documents in a single file. Doing the dyff results in 1 diff. By using the reported path as filter no diff is reported.
I was considering adding some implicit filtering in case the Kubernetes "mode" is used, i.e. generated metadata.
With regards to the issue you described at the end, any chance you have some simplified examples that you share?
from dyff.
What you mean with "implicit filtering"? Would it also work with metadata (labels/annotations) attached by e.g. the kustomize-controller?
Here an example for the filter issue:
---
# a.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: demo-app
name: demo-app
namespace: demo
spec:
selector:
matchLabels:
app: demo-app
template:
spec:
containers:
- image: hashicorp/http-echo:0.2.1
name: http-echo
---
# b.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: demo-app
name: demo-app
namespace: demo
spec:
selector:
matchLabels:
app: demo-app
template:
spec:
containers:
- image: hashicorp/http-echo:0.2.3
name: http-echo
~ dyff between --set-exit-code --omit-header a.yaml b.yaml
spec.template.spec.containers.http-echo.image
± value change
- hashicorp/http-echo:0.2.3
+ hashicorp/http-echo:0.2.1
~ echo $?
1
~ dyff between --set-exit-code --omit-header --filter "spec.template.spec.containers.http-echo.image" a.yaml b.yaml
~ echo $?
0
from dyff.
@HeavyWombat Hi, I have same issue.
I would like to add --exclude
option and filter by regular expression too.
If you don't mind, I would like to handle this issue.
from dyff.
Thank you for your response! I understand.
Then I'll fork and write the code for my purpose, without thinking about merging it into upstream.
from dyff.
@HeavyWombat Sorry, I was under the mistaken impression that you had already addressed this issue quite well and were in the process of fixing it from a more fundamental point of view.
I have submitted a PR.
Please review it as I would like to try to merge it.
#214
from dyff.
Thanks for the PR. Will have a look over the weekend. I really appreciate the feedback and support here.
from dyff.
Related Issues (20)
- dyff stutters when diffing some multiline documents HOT 8
- interaction between regular expressions and YAML path segments is unclear HOT 2
- Replace `github.com/gorilla/mux` package HOT 2
- Truncate/Filter Diff Output HOT 6
- [bug] Wrong version in latest release HOT 2
- contribute a new language model to highlight.js / github's linguist HOT 1
- Restore release of Windows binaries HOT 1
- Ability to exclude additions
- Retain color codes when piped? HOT 1
- No documentation for format of --exclude and --include options HOT 1
- `dyff yaml` incorrectly converts boolstring to bool HOT 1
- Comment breaks yaml output
- Tab completion HOT 5
- Support outputting "between" to yaml
- feature request: Bring in some diff options: ignore-all-space, recursive, brief HOT 1
- Feature request: aarch64/arm64 binaries HOT 2
- Feature request: GitHub markdown compatible diffs HOT 3
- Comments breaks nested indentation
- Different boolean represenatations of the same value treated differently
- convert from json to yaml have a bug HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dyff.