Skip to content

Why does adding a few newlines change the meaning of this where's closure? #12843

Discussion options

You must be logged in to vote

a few things i have noticed:

your and is probably missing braces on the right side

you can simplify the any. the following ones are equivalent:

| any { |cond| "reason" in $cond and $cond.reason == "PodCompleted" }
| any { |cond| $cond.reason? == "PodCompleted" }

you try to get $it.metadata.name, which does not exist (-> i have added a | default testName for my testing).

where is a bit special in nushell and does not require a closure (brackets are enough).

when applying all these things it works:

{items : [{metadata: {creationTimestamp: "2024-05-12T11:23:01Z"}, status: {conditions: [{reason: "PodCompleted"}]}}]}
| get items
| where (
  ((date now) - ($it.metadata.creationTimestamp | into …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@MatrixManAtYrService
Comment options

Answer selected by MatrixManAtYrService
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants