-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
Draft: Toml #1439
Draft: Toml #1439
Conversation
Hi @pelletier - I've got started on trying to write a decoder using your API - I'm a little confused as to how the table types work? |
pkg/yqlib/decoder_toml.go
Outdated
} | ||
|
||
func (dec *tomlDecoder) createTable(tomlNode *toml.Node) (*yaml.Node, error) { | ||
log.Debug("Table: %v", string(tomlNode.Data)) |
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.
here specifically - what's the toml.Node structure for the table? If you look at the test I've got in toml_test.go - I have
[owners]
blah = "X"
But I only see to get owners in the node child here 🤔
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.
Correct. The parser returns top level expressions. So you should have a first node for the table header, then another one for key-value.
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.
So in this example you need two calls to NextExpression() to parse the whole document (arguably 3 to detect that you're at the end of the document and stop).
until mikefarah/yq#1439 is done
until mikefarah/yq#1439 is done
No description provided.