New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added divide and modulo operators #1593
Conversation
document: "a: !horse cat_meow\nb: !goat _", | ||
expression: `.a = .a / .b`, | ||
expected: []string{ | ||
"D0, P[], (doc)::a: !horse\n - cat\n - meow\nb: !goat _\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case I think it'd be more correct if a
is an array, but each element is a horse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior came from string split. Should I try to fix it there?
❯ echo $'a: !horse cat_meow\nb: !goat _' | yq '.a | split("_")'
- cat
- meow
❯ echo $'a: !horse cat_meow\nb: !goat _' | yq '.a = (.a |split("_"))'
a: !horse
- cat
- meow
b: !goat _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see - yeah I think so 🤔 , that would be appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm not sure I can change it easily. It seems the assignment operator won't change custom tags. Changing that would be a breaking change.
❯ echo $'a: !horse cat_meow\nb: !goat _' | yq '.a = {} | .c = {} | .[] | tag'
!horse
!goat
!!map
❯ echo $'a: !horse cat_meow\nb: !goat _' | yq '.a = {} | .c = {} | .c = [] | .[] | tag'
!horse
!goat
!!seq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright - leave it, no worries
Thanks @teejaded - this looks promising :) |
Couple of failures in the pipeline - should be easy to fix. Just run |
I think it's fixed now! Sorry I neglected that step from CONTRIBUTING.md. |
fixes #49