Search and Replace: Support advanced path expressions#1225
Merged
phanimarupaka merged 1 commit intokptdev:masterfrom Nov 19, 2020
Merged
Search and Replace: Support advanced path expressions#1225phanimarupaka merged 1 commit intokptdev:masterfrom
phanimarupaka merged 1 commit intokptdev:masterfrom
Conversation
mortent
reviewed
Nov 18, 2020
| name: "search by array objects path", | ||
| args: []string{"--by-path", "spec.foo[1].c"}, | ||
| name: "search replace by array path regex", | ||
| args: []string{"--by-path", "spec.foo[1]", "--put-literal", "c"}, |
Contributor
There was a problem hiding this comment.
What happens if the provided number is outside the bounds of the array?
Contributor
Author
There was a problem hiding this comment.
It's a no match. Similar to providing non-existing path. We will support appending elements to arrays in future. https://mikefarah.gitbook.io/yq/usage/path-expressions#appending-to-arrays
Contributor
There was a problem hiding this comment.
This seems like something that would be worthy of testing. This also includes the use of negative indexes (as described in the link) if that is something that we support.
Contributor
Author
01a26ea to
4884015
Compare
4884015 to
d0762af
Compare
mortent
approved these changes
Nov 19, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@mortent
This PR supports more path expressions for search and replace.