Skip to content

Commit

Permalink
Add extra example of accessing .SelectedItem
Browse files Browse the repository at this point in the history
  • Loading branch information
vassilvk committed Apr 16, 2021
1 parent e96f279 commit 396efe4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -761,16 +761,14 @@ patch:
Note that `.SelectedItem` points to the part of the resource selected by the `select` expression.
In the above example, the `select` expression is `$.spec.containers[? @.image =~ "repo-1/.+"].image` so `.SelectedItem` is a string with the value of the image.
In the above example, the `select` expression is `$.spec.containers[? @.image =~ "repo-1/.+"].image` so `.SelectedItem` is a string with the value of the image field.
On the other hand, if the `select` expression was `$.spec.containers[? @.image =~ "repo-1/.+"]`, then `.SelectedItem` would be a string-to-value map with the properties
On the other hand, if the `select` expression was `$.spec.containers[? @.image =~ "repo-1/.+"]`, then `.SelectedItem` would be a map with the named properties
of the `container` object.
In that case, to access any of the properties of the container, one would use the `index` Golang template function.
For example:
`{{ index .SelectedItem "image" }}`
For example, `{{ index .SelectedItem "image" }}` or `{{ index .SelectedItem "imagePullPolicy" }}`.
### `rejectMessage` \(string: optional\)
Expand Down

0 comments on commit 396efe4

Please sign in to comment.