Skip to content
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

Should be possible to obtain the lines for a single attribute path from the parser. #56

Open
csabatuz-chess opened this issue Nov 6, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@csabatuz-chess
Copy link
Contributor

csabatuz-chess commented Nov 6, 2023

Assuming

import (
  parser "github.com/haproxytech/config-parser/v5"
)
...
  p := parser.New(content, options)

Currently it's possible to obtain the parsed models for all supported attributes like

log, err := p.Get(parser.Global, parser.GlobalSectionName, "log") // ([]types.Log, error)
...

It's also possible to update the data associated with the same attribute

err := p.Set(parser.Global, parser.GlobalSectionName, "log", log)

One can also render the full config using

p.String()

Proposal
In one of our use cases, we would like to obtain the resulting lines from such updates for a given attribute path.
So e.g.

lines, err := p.Render(parser.Global, parser.GlobalSectionName, "log")

Currently the lack of such granular access prevents us from effectively using the Config Parser code for our use case.

(Happily) wiling to contribute code if this feature makes sense.

@oktalz
Copy link
Member

oktalz commented Nov 10, 2023

this is what Result function is doing in parsers right?, its just that is not exposed or available

if you are willing to contribute, we can discuss that (on objections on feature as long as it does not bring large complexity)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants